use of org.ow2.proactive.scheduler.common.job.JobResult in project scheduling by ow2-proactive.
the class JobRecoverTest method checkJobResults.
private void checkJobResults(JobResult result) throws Throwable {
Map<String, TaskResult> allResults = result.getAllResults();
assertThat(allResults).hasSize(6);
for (int i = 1; i <= allResults.size(); i++) {
TaskResult taskResult = result.getResult("Computation" + i);
assertThat(taskResult.value()).isNotNull();
assertThat(taskResult.getException()).isNull();
}
}
use of org.ow2.proactive.scheduler.common.job.JobResult in project scheduling by ow2-proactive.
the class TestJobKilled method testJobKilled.
@Test
public void testJobKilled() throws Throwable {
String task1Name = "task1";
String task2Name = "task2";
String task3Name = "task3";
// cannot use SchedulerTHelper.testJobsubmission because
// task 3 is never executed so no event can be received
// regarding this task.
JobId id = schedulerHelper.submitJob(new File(jobDescriptor.toURI()).getAbsolutePath());
// check events reception
log("Job submitted, id " + id.toString());
log("Waiting for jobSubmitted");
schedulerHelper.waitForEventJobSubmitted(id);
log("Waiting for job running");
schedulerHelper.waitForEventJobRunning(id);
log("Waiting for task running : " + task1Name);
schedulerHelper.waitForEventTaskRunning(id, task1Name);
log("Waiting for task finished : " + task1Name);
schedulerHelper.waitForEventTaskFinished(id, task1Name);
log("Waiting for task running : " + task2Name);
schedulerHelper.waitForEventTaskRunning(id, task2Name);
log("Waiting for task finished : " + task2Name);
schedulerHelper.waitForEventTaskFinished(id, task2Name);
log("Waiting for job finished");
schedulerHelper.waitForEventJobFinished(id);
try {
schedulerHelper.waitForEventTaskRunning(id, task3Name, 1000);
fail("Task 3 should not be started");
} catch (ProActiveTimeoutException expected) {
// expected
}
JobResult res = schedulerHelper.getJobResult(id);
Map<String, TaskResult> results = res.getAllResults();
// check that all tasks results are defined
assertNotNull(results.get("task1").value());
assertNotNull(results.get("task2").getException());
}
use of org.ow2.proactive.scheduler.common.job.JobResult in project scheduling by ow2-proactive.
the class SchedulerFrontend method getJobResult.
/**
* {@inheritDoc}
*/
@Override
@ImmediateService
public JobResult getJobResult(final JobId jobId) throws NotConnectedException, PermissionException, UnknownJobException {
// checking permissions
IdentifiedJob ij = frontendState.getIdentifiedJob(jobId);
frontendState.checkPermissions("getJobResult", ij, YOU_DO_NOT_HAVE_PERMISSION_TO_GET_THE_RESULT_OF_THIS_JOB);
if (!ij.isFinished()) {
jlogger.info(jobId, "is not finished");
jlogger.info(jobId, "Job state: " + frontendState.getJobState(jobId).getStatus());
return null;
}
jlogger.info(jobId, "trying to get the job result");
JobResult result = dbManager.loadJobResult(jobId);
if (result == null) {
throw new UnknownJobException(jobId);
}
if (!result.getJobInfo().isToBeRemoved() && SCHEDULER_REMOVED_JOB_DELAY > 0) {
// remember that this job is to be removed
dbManager.jobSetToBeRemoved(jobId);
schedulingService.scheduleJobRemove(jobId, System.currentTimeMillis() + SCHEDULER_REMOVED_JOB_DELAY);
jlogger.info(jobId, "will be removed in " + (SCHEDULER_REMOVED_JOB_DELAY / 1000) + "sec");
}
return result;
}
Aggregations