use of org.apache.tez.test.service.rpc.TezTestServiceProtocolProtos.TaskSpecProto.Builder in project tez by apache.
the class ProtoConverters method convertTaskSpecToProto.
public static TaskSpecProto convertTaskSpecToProto(TaskSpec taskSpec) {
Builder builder = TaskSpecProto.newBuilder();
builder.setTaskAttemptIdString(taskSpec.getTaskAttemptID().toString());
builder.setDagName(taskSpec.getDAGName());
builder.setVertexName(taskSpec.getVertexName());
builder.setVertexParallelism(taskSpec.getVertexParallelism());
if (taskSpec.getProcessorDescriptor() != null) {
builder.setProcessorDescriptor(DagTypeConverters.convertToDAGPlan(taskSpec.getProcessorDescriptor()));
}
if (taskSpec.getInputs() != null && !taskSpec.getInputs().isEmpty()) {
for (InputSpec inputSpec : taskSpec.getInputs()) {
builder.addInputSpecs(convertInputSpecToProto(inputSpec));
}
}
if (taskSpec.getOutputs() != null && !taskSpec.getOutputs().isEmpty()) {
for (OutputSpec outputSpec : taskSpec.getOutputs()) {
builder.addOutputSpecs(convertOutputSpecToProto(outputSpec));
}
}
if (taskSpec.getGroupInputs() != null && !taskSpec.getGroupInputs().isEmpty()) {
for (GroupInputSpec groupInputSpec : taskSpec.getGroupInputs()) {
builder.addGroupedInputSpecs(convertGroupInputSpecToProto(groupInputSpec));
}
}
if (taskSpec.getTaskConf() != null) {
ConfigurationProto.Builder confBuilder = ConfigurationProto.newBuilder();
Iterator<Entry<String, String>> iter = taskSpec.getTaskConf().iterator();
while (iter.hasNext()) {
Entry<String, String> entry = iter.next();
confBuilder.addConfKeyValues(PlanKeyValuePair.newBuilder().setKey(entry.getKey()).setValue(entry.getValue()).build());
}
builder.setTaskConf(confBuilder.build());
}
return builder.build();
}
Aggregations