Search in sources :

Example 1 with NotTezEvent

use of org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.NotTezEvent in project hive by apache.

the class NotTezEventHelper method createSignableNotTezEvent.

public static Signable createSignableNotTezEvent(InputDataInformationEvent event, String vertexName, String destInputName) {
    final NotTezEvent.Builder builder = NotTezEvent.newBuilder().setInputEventProtoBytes(ProtoConverters.convertRootInputDataInformationEventToProto(event).toByteString()).setVertexName(vertexName).setDestInputName(destInputName);
    return new Signable() {

        @Override
        public void setSignInfo(int masterKeyId) {
            builder.setKeyId(masterKeyId);
        }

        @Override
        public byte[] serialize() throws IOException {
            NotTezEvent nte = builder.build();
            ByteArrayOutputStream baos = new ByteArrayOutputStream(nte.getSerializedSize());
            nte.writeTo(baos);
            return baos.toByteArray();
        }
    };
}
Also used : NotTezEvent(org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.NotTezEvent) Signable(org.apache.hadoop.hive.llap.security.LlapSigner.Signable) ByteArrayOutputStream(java.io.ByteArrayOutputStream)

Example 2 with NotTezEvent

use of org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.NotTezEvent in project hive by apache.

the class ContainerRunnerImpl method extractInitialEvent.

private TezEvent extractInitialEvent(SubmitWorkRequestProto request, LlapTokenInfo tokenInfo) throws InvalidProtocolBufferException {
    if (!request.hasInitialEventBytes())
        return null;
    ByteString initialEventByteString = request.getInitialEventBytes();
    byte[] initialEventBytes = initialEventByteString.toByteArray();
    NotTezEvent initialEvent = NotTezEvent.parseFrom(initialEventBytes);
    if (tokenInfo.isSigningRequired) {
        if (!request.hasInitialEventSignature()) {
            logSecurityErrorRarely(tokenInfo.userName);
            throw new SecurityException("Unsigned initial event is not allowed");
        }
        byte[] signatureBytes = request.getInitialEventSignature().toByteArray();
        try {
            signer.checkSignature(initialEventBytes, signatureBytes, initialEvent.getKeyId());
        } catch (SecurityException ex) {
            logSecurityErrorRarely(tokenInfo.userName);
            throw ex;
        }
    }
    return NotTezEventHelper.toTezEvent(initialEvent);
}
Also used : ByteString(com.google.protobuf.ByteString) NotTezEvent(org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.NotTezEvent)

Example 3 with NotTezEvent

use of org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.NotTezEvent in project hive by apache.

the class NotTezEventHelper method toTezEvent.

public static TezEvent toTezEvent(NotTezEvent nte) throws InvalidProtocolBufferException {
    EventMetaData sourceMetaData = new EventMetaData(EventMetaData.EventProducerConsumerType.INPUT, nte.getVertexName(), "NULL_VERTEX", null);
    EventMetaData destMetaData = new EventMetaData(EventMetaData.EventProducerConsumerType.INPUT, nte.getVertexName(), nte.getDestInputName(), null);
    InputDataInformationEvent event = ProtoConverters.convertRootInputDataInformationEventFromProto(RootInputDataInformationEventProto.parseFrom(nte.getInputEventProtoBytes()));
    TezEvent tezEvent = new TezEvent(event, sourceMetaData, System.currentTimeMillis());
    tezEvent.setDestinationInfo(destMetaData);
    return tezEvent;
}
Also used : NotTezEvent(org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.NotTezEvent) TezEvent(org.apache.tez.runtime.api.impl.TezEvent) EventMetaData(org.apache.tez.runtime.api.impl.EventMetaData) InputDataInformationEvent(org.apache.tez.runtime.api.events.InputDataInformationEvent)

Aggregations

NotTezEvent (org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.NotTezEvent)3 ByteString (com.google.protobuf.ByteString)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 Signable (org.apache.hadoop.hive.llap.security.LlapSigner.Signable)1 InputDataInformationEvent (org.apache.tez.runtime.api.events.InputDataInformationEvent)1 EventMetaData (org.apache.tez.runtime.api.impl.EventMetaData)1 TezEvent (org.apache.tez.runtime.api.impl.TezEvent)1