use of com.hazelcast.jet.impl.JobResult in project hazelcast by hazelcast.
the class SuspendResumeTest method when_cancelSuspendedJob_then_jobCancels.
@Test
public void when_cancelSuspendedJob_then_jobCancels() throws Exception {
Job job = instances[0].getJet().newJob(dag);
NoOutputSourceP.executionStarted.await();
job.suspend();
assertJobStatusEventually(job, SUSPENDED);
// When-Then
cancelAndJoin(job);
assertJobStatusEventually(job, FAILED);
// check that job resources are deleted
JobRepository jobRepository = new JobRepository(instances[0]);
assertTrueEventually(() -> {
assertNull("JobRecord", jobRepository.getJobRecord(job.getId()));
JobResult jobResult = jobRepository.getJobResult(job.getId());
assertContains(jobResult.getFailureText(), CancellationException.class.getName());
assertFalse("Job result successful", jobResult.isSuccessful());
});
}
use of com.hazelcast.jet.impl.JobResult in project hazelcast by hazelcast.
the class ExecutionLifecycleTest method assertJobFailed.
private void assertJobFailed(Job job, Throwable expected) {
assertTrue(job.getFuture().isDone());
try {
job.join();
fail("job didn't fail");
} catch (Throwable caught) {
assertExceptionInCauses(expected, caught);
}
if (!job.isLightJob()) {
Job normalJob = job;
JobResult jobResult = getJobResult(normalJob);
assertFalse("jobResult.isSuccessful", jobResult.isSuccessful());
assertNotNull(jobResult.getFailureText());
assertContains(jobResult.getFailureText(), expected.toString());
assertEquals("jobStatus", JobStatus.FAILED, normalJob.getStatus());
}
}
use of com.hazelcast.jet.impl.JobResult in project hazelcast by hazelcast.
the class ExecutionLifecycleTest method getJobResult.
private JobResult getJobResult(Job job) {
JetServiceBackend jetServiceBackend = getJetServiceBackend(instance());
assertNull(jetServiceBackend.getJobRepository().getJobRecord(job.getId()));
JobResult jobResult = jetServiceBackend.getJobRepository().getJobResult(job.getId());
assertNotNull(jobResult);
return jobResult;
}
use of com.hazelcast.jet.impl.JobResult in project hazelcast-jet by hazelcast.
the class ExecutionLifecycleTest method assertJobSucceeded.
private void assertJobSucceeded(Job job) {
JobResult jobResult = getJobResult(job);
assertTrue(jobResult.isSuccessful());
assertNull(jobResult.getFailure());
}
Aggregations