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;
}
Aggregations