Search in sources :

Example 1 with GroupInputSpecProto

use of org.apache.tez.test.service.rpc.TezTestServiceProtocolProtos.GroupInputSpecProto in project tez by apache.

the class ProtoConverters method getTaskSpecfromProto.

public static TaskSpec getTaskSpecfromProto(TaskSpecProto taskSpecProto) {
    TezTaskAttemptID taskAttemptID = TezTaskAttemptID.fromString(taskSpecProto.getTaskAttemptIdString());
    ProcessorDescriptor processorDescriptor = null;
    if (taskSpecProto.hasProcessorDescriptor()) {
        processorDescriptor = DagTypeConverters.convertProcessorDescriptorFromDAGPlan(taskSpecProto.getProcessorDescriptor());
    }
    List<InputSpec> inputSpecList = new ArrayList<InputSpec>(taskSpecProto.getInputSpecsCount());
    if (taskSpecProto.getInputSpecsCount() > 0) {
        for (IOSpecProto inputSpecProto : taskSpecProto.getInputSpecsList()) {
            inputSpecList.add(getInputSpecFromProto(inputSpecProto));
        }
    }
    List<OutputSpec> outputSpecList = new ArrayList<OutputSpec>(taskSpecProto.getOutputSpecsCount());
    if (taskSpecProto.getOutputSpecsCount() > 0) {
        for (IOSpecProto outputSpecProto : taskSpecProto.getOutputSpecsList()) {
            outputSpecList.add(getOutputSpecFromProto(outputSpecProto));
        }
    }
    List<GroupInputSpec> groupInputSpecs = new ArrayList<GroupInputSpec>(taskSpecProto.getGroupedInputSpecsCount());
    if (taskSpecProto.getGroupedInputSpecsCount() > 0) {
        for (GroupInputSpecProto groupInputSpecProto : taskSpecProto.getGroupedInputSpecsList()) {
            groupInputSpecs.add(getGroupInputSpecFromProto(groupInputSpecProto));
        }
    }
    Configuration taskConf = null;
    if (taskSpecProto.hasTaskConf()) {
        taskConf = new Configuration(false);
        Map<String, String> confMap = DagTypeConverters.convertConfFromProto(taskSpecProto.getTaskConf());
        for (Entry<String, String> e : confMap.entrySet()) {
            taskConf.set(e.getKey(), e.getValue());
        }
    }
    TaskSpec taskSpec = new TaskSpec(taskAttemptID, taskSpecProto.getDagName(), taskSpecProto.getVertexName(), taskSpecProto.getVertexParallelism(), processorDescriptor, inputSpecList, outputSpecList, groupInputSpecs, taskConf);
    return taskSpec;
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) TaskSpec(org.apache.tez.runtime.api.impl.TaskSpec) ArrayList(java.util.ArrayList) ProcessorDescriptor(org.apache.tez.dag.api.ProcessorDescriptor) GroupInputSpec(org.apache.tez.runtime.api.impl.GroupInputSpec) InputSpec(org.apache.tez.runtime.api.impl.InputSpec) GroupInputSpecProto(org.apache.tez.test.service.rpc.TezTestServiceProtocolProtos.GroupInputSpecProto) IOSpecProto(org.apache.tez.test.service.rpc.TezTestServiceProtocolProtos.IOSpecProto) TezTaskAttemptID(org.apache.tez.dag.records.TezTaskAttemptID) OutputSpec(org.apache.tez.runtime.api.impl.OutputSpec) GroupInputSpec(org.apache.tez.runtime.api.impl.GroupInputSpec)

Aggregations

ArrayList (java.util.ArrayList)1 Configuration (org.apache.hadoop.conf.Configuration)1 ProcessorDescriptor (org.apache.tez.dag.api.ProcessorDescriptor)1 TezTaskAttemptID (org.apache.tez.dag.records.TezTaskAttemptID)1 GroupInputSpec (org.apache.tez.runtime.api.impl.GroupInputSpec)1 InputSpec (org.apache.tez.runtime.api.impl.InputSpec)1 OutputSpec (org.apache.tez.runtime.api.impl.OutputSpec)1 TaskSpec (org.apache.tez.runtime.api.impl.TaskSpec)1 GroupInputSpecProto (org.apache.tez.test.service.rpc.TezTestServiceProtocolProtos.GroupInputSpecProto)1 IOSpecProto (org.apache.tez.test.service.rpc.TezTestServiceProtocolProtos.IOSpecProto)1