use of com.hazelcast.jet.impl.JetService in project hazelcast-jet by hazelcast.
the class JoinSubmittedJobOperation method doRun.
@Override
protected void doRun() {
JetService service = getService();
JobCoordinationService coordinationService = service.getJobCoordinationService();
CompletableFuture<Void> executionFuture = coordinationService.joinSubmittedJob(jobId());
executionFuture.whenComplete(withTryCatch(getLogger(), (r, t) -> doSendResponse(peel(t))));
}
use of com.hazelcast.jet.impl.JetService 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.JetService in project hazelcast-jet by hazelcast.
the class SubmitJobOperation method run.
@Override
public void run() {
JetService service = getService();
JobCoordinationService coordinationService = service.getJobCoordinationService();
coordinationService.submitOrJoinJob(jobId(), dag, config);
}
use of com.hazelcast.jet.impl.JetService in project hazelcast-jet by hazelcast.
the class AsyncMapWriterTest method when_memberLeaves_then_retryAutomatically.
@Test
@Ignore("This test is currently racy as an operation is only retried once.")
public void when_memberLeaves_then_retryAutomatically() throws Exception {
// Given
for (int i = 0; i < 100; i++) {
writer.put(i, i);
}
CompletableFuture<Void> future = new CompletableFuture<>();
JetService service = nodeEngine.getService(JetService.SERVICE_NAME);
service.numConcurrentPutAllOps().set(MAX_PARALLEL_ASYNC_OPS - NODE_COUNT);
// When
boolean flushed = writer.tryFlushAsync(future);
assertTrue("tryFlushAsync returned false", flushed);
terminateInstance(instance2);
// Then
future.get();
for (int i = 0; i < 100; i++) {
assertEquals(i, map.get(i));
}
}
use of com.hazelcast.jet.impl.JetService in project hazelcast-jet by hazelcast.
the class AsyncMapWriterTest method when_opFinished_then_releaseCount.
@Test
public void when_opFinished_then_releaseCount() throws Exception {
// Given
writer.put("key1", "value1");
CompletableFuture<Void> future = new CompletableFuture<>();
JetService service = nodeEngine.getService(JetService.SERVICE_NAME);
service.numConcurrentPutAllOps().set(MAX_PARALLEL_ASYNC_OPS - NODE_COUNT);
// When
boolean flushed = writer.tryFlushAsync(future);
assertTrue("tryFlushAsync returned false", flushed);
future.get();
writer.put("key2", "value2");
flushed = writer.tryFlushAsync(future);
// Then
assertTrue("tryFlushAsync returned false", flushed);
}
Aggregations