use of org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder in project flink by apache.
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 apache.
the class RootExceptionHistoryEntryTest method extractExecutionVertex.
private ExecutionVertex extractExecutionVertex(int pos) {
final ExecutionVertex executionVertex = Iterables.get(executionGraph.getAllExecutionVertices(), pos);
executionVertex.tryAssignResource(new TestingLogicalSlotBuilder().createTestingLogicalSlot());
return executionVertex;
}
use of org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder in project flink by apache.
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 apache.
the class SharedSlotTest method testReturnLogicalSlotRejectsUnknownSlot.
@Test(expected = IllegalStateException.class)
public void testReturnLogicalSlotRejectsUnknownSlot() {
final TestingPhysicalSlot physicalSlot = TestingPhysicalSlot.builder().build();
final SharedSlot sharedSlot = new SharedSlot(new SlotRequestId(), physicalSlot, false, () -> {
});
final LogicalSlot logicalSlot = new TestingLogicalSlotBuilder().createTestingLogicalSlot();
logicalSlot.releaseSlot(new Exception("test"));
sharedSlot.returnLogicalSlot(logicalSlot);
}
use of org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder in project flink by apache.
the class ExecutionVertexCancelTest method testCancelFromRunningDidNotFindTask.
@Test
public void testCancelFromRunningDidNotFindTask() {
// this may happen when the task finished or failed while the call was in progress
try {
final ExecutionVertex vertex = getExecutionVertex();
LogicalSlot slot = new TestingLogicalSlotBuilder().setTaskManagerGateway(new CancelSequenceSimpleAckingTaskManagerGateway(1)).createTestingLogicalSlot();
setVertexResource(vertex, slot);
setVertexState(vertex, ExecutionState.RUNNING);
assertEquals(ExecutionState.RUNNING, vertex.getExecutionState());
vertex.cancel();
assertEquals(ExecutionState.CANCELING, vertex.getExecutionState());
assertFalse(vertex.getFailureInfo().isPresent());
assertTrue(vertex.getStateTimestamp(ExecutionState.CREATED) > 0);
assertTrue(vertex.getStateTimestamp(ExecutionState.CANCELING) > 0);
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
Aggregations