use of org.apache.tez.runtime.api.impl.InputSpec in project hive by apache.
the class SourceStateTracker method getSourceInterestList.
private List<String> getSourceInterestList(List<InputSpec> inputSpecList) {
List<String> sourcesOfInterest = Collections.emptyList();
if (inputSpecList != null) {
boolean alreadyFound = false;
for (InputSpec inputSpec : inputSpecList) {
if (LlapTezUtils.isSourceOfInterest(inputSpec.getInputDescriptor().getClassName())) {
if (!alreadyFound) {
alreadyFound = true;
sourcesOfInterest = new LinkedList<>();
}
sourcesOfInterest.add(inputSpec.getSourceVertexName());
}
}
}
return sourcesOfInterest;
}
use of org.apache.tez.runtime.api.impl.InputSpec in project hive by apache.
the class TaskSpecBuilder method constructTaskSpec.
public TaskSpec constructTaskSpec(DAG dag, String vertexName, int numSplits, ApplicationId appId, int index) {
Vertex vertex = dag.getVertex(vertexName);
ProcessorDescriptor processorDescriptor = vertex.getProcessorDescriptor();
List<RootInputLeafOutput<InputDescriptor, InputInitializerDescriptor>> inputs = vertex.getInputs();
List<RootInputLeafOutput<OutputDescriptor, OutputCommitterDescriptor>> outputs = vertex.getOutputs();
Preconditions.checkState(inputs.size() == 1);
Preconditions.checkState(outputs.size() == 1);
List<InputSpec> inputSpecs = new ArrayList<>();
for (RootInputLeafOutput<InputDescriptor, InputInitializerDescriptor> input : inputs) {
InputSpec inputSpec = new InputSpec(input.getName(), input.getIODescriptor(), 1);
inputSpecs.add(inputSpec);
}
List<OutputSpec> outputSpecs = new ArrayList<>();
for (RootInputLeafOutput<OutputDescriptor, OutputCommitterDescriptor> output : outputs) {
OutputSpec outputSpec = new OutputSpec(output.getName(), output.getIODescriptor(), 1);
outputSpecs.add(outputSpec);
}
TezDAGID dagId = TezDAGID.getInstance(appId, 0);
TezVertexID vertexId = TezVertexID.getInstance(dagId, 0);
TezTaskID taskId = TezTaskID.getInstance(vertexId, index);
TezTaskAttemptID taskAttemptId = TezTaskAttemptID.getInstance(taskId, 0);
return new TaskSpec(taskAttemptId, dag.getName(), vertexName, numSplits, processorDescriptor, inputSpecs, outputSpecs, null);
}
use of org.apache.tez.runtime.api.impl.InputSpec in project tez by apache.
the class TestVertexImpl method testFailuresMaxPercentExceededSourceTaskAttemptCompletionEvents.
@Test(timeout = 5000)
public void testFailuresMaxPercentExceededSourceTaskAttemptCompletionEvents() throws TezException {
LOG.info("Testing testFailuresMaxPercentSourceTaskAttemptCompletionEvents");
// Override the basic setup for this test to inject the specific config setting needed for this test
useCustomInitializer = false;
customInitializer = null;
setupPreDagCreation();
conf.setFloat(TezConfiguration.TEZ_VERTEX_FAILURES_MAXPERCENT, 50.0f);
conf.setInt(TezConfiguration.TEZ_AM_TASK_MAX_FAILED_ATTEMPTS, 1);
dagPlan = createTestDAGPlan();
setupPostDagCreation();
initAllVertices(VertexState.INITED);
VertexImpl v4 = vertices.get("vertex4");
VertexImpl v5 = vertices.get("vertex5");
VertexImpl v6 = vertices.get("vertex6");
startVertex(vertices.get("vertex1"));
startVertex(vertices.get("vertex2"));
dispatcher.await();
LOG.info("Verifying v6 state " + v6.getState());
Assert.assertEquals(VertexState.RUNNING, v6.getState());
TezTaskID t1_v4 = TezTaskID.getInstance(v4.getVertexId(), 0);
TezTaskID t2_v4 = TezTaskID.getInstance(v4.getVertexId(), 1);
TezTaskID t1_v5 = TezTaskID.getInstance(v5.getVertexId(), 0);
TezTaskID t2_v5 = TezTaskID.getInstance(v5.getVertexId(), 1);
TezTaskAttemptID ta1_t1_v4 = TezTaskAttemptID.getInstance(t1_v4, 0);
TezTaskAttemptID ta1_t2_v4 = TezTaskAttemptID.getInstance(t2_v4, 0);
TezTaskAttemptID ta1_t1_v5 = TezTaskAttemptID.getInstance(t1_v5, 0);
TezTaskAttemptID ta1_t2_v5 = TezTaskAttemptID.getInstance(t2_v5, 0);
TaskSpec taskSpec = new TaskSpec("dag", "vertex", 2, new ProcessorDescriptor(), new ArrayList<InputSpec>(), new ArrayList<OutputSpec>(), null, conf);
TaskLocationHint locationHint = TaskLocationHint.createTaskLocationHint(null, null);
// Tasks can only succeed from a scheduled or running state
dispatcher.getEventHandler().handle(new TaskEventScheduleTask(t1_v4, taskSpec, locationHint, false));
dispatcher.getEventHandler().handle(new TaskEventScheduleTask(t2_v4, taskSpec, locationHint, false));
// Completed tasks are more that the max percent failure
dispatcher.getEventHandler().handle(new TaskEventTAFailed(ta1_t1_v4, TaskFailureType.NON_FATAL, null));
dispatcher.getEventHandler().handle(new TaskEventTAFailed(ta1_t2_v4, TaskFailureType.NON_FATAL, null));
dispatcher.getEventHandler().handle(new TaskEventTASucceeded(ta1_t1_v5));
dispatcher.getEventHandler().handle(new TaskEventTAFailed(ta1_t2_v5, TaskFailureType.NON_FATAL, null));
dispatcher.await();
Assert.assertEquals(VertexState.FAILED, v4.getState());
Assert.assertEquals(VertexState.SUCCEEDED, v5.getState());
Assert.assertEquals(VertexState.RUNNING, v6.getState());
Assert.assertEquals(2, v6.numSuccessSourceAttemptCompletions);
}
use of org.apache.tez.runtime.api.impl.InputSpec in project tez by apache.
the class TestVertexImpl method testVertexRootInputSpecUpdatePerTask.
@Test(timeout = 5000)
public void testVertexRootInputSpecUpdatePerTask() throws Exception {
useCustomInitializer = true;
setupPreDagCreation();
dagPlan = createDAGPlanWithInputInitializer("TestInputInitializer");
setupPostDagCreation();
int expectedNumTasks = RootInputSpecUpdaterVertexManager.NUM_TASKS;
VertexImplWithControlledInitializerManager v4 = (VertexImplWithControlledInitializerManager) vertices.get("vertex4");
dispatcher.getEventHandler().handle(new VertexEvent(v4.getVertexId(), VertexEventType.V_INIT));
dispatcher.await();
Assert.assertEquals(VertexState.INITIALIZING, v4.getState());
RootInputInitializerManagerControlled initializerManager1 = v4.getRootInputInitializerManager();
initializerManager1.completeInputInitialization();
dispatcher.await();
Assert.assertEquals(VertexState.INITED, v4.getState());
Assert.assertEquals(expectedNumTasks, v4.getTotalTasks());
Assert.assertEquals(RootInputSpecUpdaterVertexManager.class.getName(), v4.getVertexManager().getPlugin().getClass().getName());
Assert.assertEquals(true, initializerManager1.hasShutDown);
for (int i = 0; i < expectedNumTasks; i++) {
List<InputSpec> inputSpecs = v4.getInputSpecList(i);
Assert.assertEquals(1, inputSpecs.size());
Assert.assertEquals(i + 1, inputSpecs.get(0).getPhysicalEdgeCount());
}
}
use of org.apache.tez.runtime.api.impl.InputSpec in project tez by apache.
the class TestContainerReuse method createLaunchRequestEvent.
private AMSchedulerEventTALaunchRequest createLaunchRequestEvent(TezTaskAttemptID taID, TaskAttempt ta, Resource capability, String[] hosts, String[] racks, Priority priority, ContainerContext containerContext) {
TaskLocationHint locationHint = null;
if (hosts != null || racks != null) {
Set<String> hostsSet = Sets.newHashSet(hosts);
Set<String> racksSet = Sets.newHashSet(racks);
locationHint = TaskLocationHint.createTaskLocationHint(hostsSet, racksSet);
}
AMSchedulerEventTALaunchRequest lr = new AMSchedulerEventTALaunchRequest(taID, capability, new TaskSpec(taID, "dagName", "vertexName", -1, ProcessorDescriptor.create("processorClassName"), Collections.singletonList(new InputSpec("vertexName", InputDescriptor.create("inputClassName"), 1)), Collections.singletonList(new OutputSpec("vertexName", OutputDescriptor.create("outputClassName"), 1)), null, null), ta, locationHint, priority.getPriority(), containerContext, 0, 0, 0);
return lr;
}
Aggregations