use of org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder in project flink by splunk.
the class RegionToRestartInBatchJobBenchmark method setup.
@Override
public void setup(JobConfiguration jobConfiguration) throws Exception {
super.setup(jobConfiguration);
final JobVertex source = jobVertices.get(0);
final JobVertex sink = jobVertices.get(1);
final TestingLogicalSlotBuilder slotBuilder = new TestingLogicalSlotBuilder();
deployTasks(executionGraph, source.getID(), slotBuilder, true);
transitionTaskStatus(executionGraph, source.getID(), ExecutionState.FINISHED);
deployTasks(executionGraph, sink.getID(), slotBuilder, true);
}
use of org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder in project flink by splunk.
the class RegionToRestartInStreamingJobBenchmark method setup.
@Override
public void setup(JobConfiguration jobConfiguration) throws Exception {
super.setup(jobConfiguration);
TestingLogicalSlotBuilder slotBuilder = new TestingLogicalSlotBuilder();
deployAllTasks(executionGraph, slotBuilder);
switchAllVerticesToRunning(executionGraph);
}
use of org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder in project flink by splunk.
the class DeployingTasksBenchmarkBase method setup.
public void setup(JobConfiguration jobConfiguration) throws Exception {
super.setup();
jobVertices = createDefaultJobVertices(jobConfiguration);
executionGraph = createAndInitExecutionGraph(jobVertices, jobConfiguration, scheduledExecutorService);
final TestingLogicalSlotBuilder slotBuilder = new TestingLogicalSlotBuilder();
for (ExecutionJobVertex ejv : executionGraph.getVerticesTopologically()) {
for (ExecutionVertex ev : ejv.getTaskVertices()) {
final LogicalSlot slot = slotBuilder.createTestingLogicalSlot();
final Execution execution = ev.getCurrentExecutionAttempt();
execution.registerProducedPartitions(slot.getTaskManagerLocation(), true).get();
if (!execution.tryAssignResource(slot)) {
throw new RuntimeException("Error when assigning slot to execution.");
}
}
}
}
use of org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder in project flink by splunk.
the class ExecutionVertexDeploymentTest method testDeployCall.
@Test
public void testDeployCall() {
try {
final ExecutionVertex vertex = getExecutionVertex();
final LogicalSlot slot = new TestingLogicalSlotBuilder().createTestingLogicalSlot();
assertEquals(ExecutionState.CREATED, vertex.getExecutionState());
vertex.getCurrentExecutionAttempt().transitionState(ExecutionState.SCHEDULED);
vertex.deployToSlot(slot);
assertEquals(ExecutionState.DEPLOYING, vertex.getExecutionState());
// no repeated scheduling
try {
vertex.deployToSlot(slot);
fail("Scheduled from wrong state");
} catch (IllegalStateException e) {
// as expected
}
assertFalse(vertex.getFailureInfo().isPresent());
assertTrue(vertex.getStateTimestamp(ExecutionState.CREATED) > 0);
assertTrue(vertex.getStateTimestamp(ExecutionState.DEPLOYING) > 0);
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder in project flink by splunk.
the class ExecutionVertexDeploymentTest method testDeployFailedSynchronous.
@Test
public void testDeployFailedSynchronous() {
try {
final ExecutionVertex vertex = getExecutionVertex();
final LogicalSlot slot = new TestingLogicalSlotBuilder().setTaskManagerGateway(new SubmitFailingSimpleAckingTaskManagerGateway()).createTestingLogicalSlot();
assertEquals(ExecutionState.CREATED, vertex.getExecutionState());
vertex.getCurrentExecutionAttempt().transitionState(ExecutionState.SCHEDULED);
vertex.deployToSlot(slot);
assertEquals(ExecutionState.FAILED, vertex.getExecutionState());
assertTrue(vertex.getFailureInfo().isPresent());
assertThat(vertex.getFailureInfo().map(ErrorInfo::getExceptionAsString).get(), containsString(ERROR_MESSAGE));
assertTrue(vertex.getStateTimestamp(ExecutionState.CREATED) > 0);
assertTrue(vertex.getStateTimestamp(ExecutionState.DEPLOYING) > 0);
assertTrue(vertex.getStateTimestamp(ExecutionState.FAILED) > 0);
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
Aggregations