Search in sources :

Example 51 with JobResult

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();
    }
}
Also used : TaskResult(org.ow2.proactive.scheduler.common.task.TaskResult)

Example 52 with JobResult

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());
}
Also used : ProActiveTimeoutException(org.objectweb.proactive.core.ProActiveTimeoutException) JobResult(org.ow2.proactive.scheduler.common.job.JobResult) TaskResult(org.ow2.proactive.scheduler.common.task.TaskResult) File(java.io.File) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 53 with JobResult

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;
}
Also used : JobResult(org.ow2.proactive.scheduler.common.job.JobResult) UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException) IdentifiedJob(org.ow2.proactive.scheduler.job.IdentifiedJob) ImmediateService(org.objectweb.proactive.annotation.ImmediateService)

Aggregations

JobResult (org.ow2.proactive.scheduler.common.job.JobResult)39 JobId (org.ow2.proactive.scheduler.common.job.JobId)26 Test (org.junit.Test)25 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)24 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)22 File (java.io.File)16 Scheduler (org.ow2.proactive.scheduler.common.Scheduler)9 JavaTask (org.ow2.proactive.scheduler.common.task.JavaTask)7 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)6 NativeTask (org.ow2.proactive.scheduler.common.task.NativeTask)6 JobResultImpl (org.ow2.proactive.scheduler.job.JobResultImpl)6 TaskResultImpl (org.ow2.proactive.scheduler.task.TaskResultImpl)6 Job (org.ow2.proactive.scheduler.common.job.Job)4 JobInfo (org.ow2.proactive.scheduler.common.job.JobInfo)4 ForkEnvironment (org.ow2.proactive.scheduler.common.task.ForkEnvironment)4 TaskState (org.ow2.proactive.scheduler.common.task.TaskState)4 NonTerminatingJob (functionaltests.jobs.NonTerminatingJob)3 SimpleJob (functionaltests.jobs.SimpleJob)3 HashMap (java.util.HashMap)3 NotConnectedException (org.ow2.proactive.scheduler.common.exception.NotConnectedException)3