use of com.hazelcast.jet.impl.execution.ExecutionContext in project hazelcast-jet by hazelcast.
the class Networking method handleStreamPacket.
private void handleStreamPacket(Packet packet) throws IOException {
BufferObjectDataInput in = createObjectDataInput(nodeEngine, packet.toByteArray());
long executionId = in.readLong();
int vertexId = in.readInt();
int ordinal = in.readInt();
ExecutionContext executionContext = jobExecutionService.getExecutionContext(executionId);
executionContext.handlePacket(vertexId, ordinal, packet.getConn().getEndPoint(), in);
}
use of com.hazelcast.jet.impl.execution.ExecutionContext in project hazelcast-jet by hazelcast.
the class CancelExecutionOperation method run.
@Override
public void run() throws Exception {
JetService service = getService();
JobExecutionService executionService = service.getJobExecutionService();
Address callerAddress = getCallerAddress();
ExecutionContext ctx = executionService.assertExecutionContext(callerAddress, jobId(), executionId, this);
ctx.cancelExecution();
}
use of com.hazelcast.jet.impl.execution.ExecutionContext in project hazelcast-jet by hazelcast.
the class SnapshotOperation method doRun.
@Override
protected void doRun() throws Exception {
JetService service = getService();
ExecutionContext ctx = service.getJobExecutionService().assertExecutionContext(getCallerAddress(), jobId(), executionId, this);
ctx.beginSnapshot(snapshotId).thenAccept(r -> {
logFine(getLogger(), "Snapshot %s for job %s finished successfully on member", snapshotId, idToString(jobId()));
doSendResponse(null);
}).exceptionally(e -> {
getLogger().warning(String.format("Snapshot %d for job %s finished with error on member", snapshotId, idToString(jobId())), e);
doSendResponse(new JetException("Exception during snapshot: " + e, e));
return null;
});
}
use of com.hazelcast.jet.impl.execution.ExecutionContext in project hazelcast-jet by hazelcast.
the class ExecutionLifecycleTest method when_executionCancelledBeforeStart_then_jobFutureIsCancelledOnExecute.
@Test
public void when_executionCancelledBeforeStart_then_jobFutureIsCancelledOnExecute() {
// Given
DAG dag = new DAG().vertex(new Vertex("test", new MockPS(StuckProcessor::new, NODE_COUNT)));
NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(instance.getHazelcastInstance());
Address localAddress = nodeEngineImpl.getThisAddress();
ClusterServiceImpl clusterService = (ClusterServiceImpl) nodeEngineImpl.getClusterService();
MembersView membersView = clusterService.getMembershipManager().getMembersView();
int memberListVersion = membersView.getVersion();
JetService jetService = getJetService(instance);
final Map<MemberInfo, ExecutionPlan> executionPlans = ExecutionPlanBuilder.createExecutionPlans(nodeEngineImpl, membersView, dag, new JobConfig(), NO_SNAPSHOT);
ExecutionPlan executionPlan = executionPlans.get(membersView.getMember(localAddress));
long jobId = 0;
long executionId = 1;
Set<MemberInfo> participants = new HashSet<>(membersView.getMembers());
jetService.getJobExecutionService().initExecution(jobId, executionId, localAddress, memberListVersion, participants, executionPlan);
ExecutionContext executionContext = jetService.getJobExecutionService().getExecutionContext(executionId);
executionContext.cancelExecution();
// When
CompletableFuture<Void> future = executionContext.beginExecution();
// Then
expectedException.expect(CancellationException.class);
future.join();
}
Aggregations