Search in sources :

Example 46 with JobInfo

use of org.ow2.proactive.scheduler.common.job.JobInfo in project scheduling by ow2-proactive.

the class TestLoadJobs method testLoadNoJob.

@Test
public void testLoadNoJob() throws Exception {
    Scheduler scheduler = schedulerHelper.getSchedulerInterface();
    List<JobInfo> jobs = scheduler.getJobs(0, 0, criteria(true, true, true, true), null).getList();
    assertTrue(jobs.isEmpty());
}
Also used : JobInfo(org.ow2.proactive.scheduler.common.job.JobInfo) Scheduler(org.ow2.proactive.scheduler.common.Scheduler) Test(org.junit.Test)

Example 47 with JobInfo

use of org.ow2.proactive.scheduler.common.job.JobInfo in project scheduling by ow2-proactive.

the class TestDataspaceConcurrentKilling method multiple_tasks_transferring_with_kill.

@Test
public void multiple_tasks_transferring_with_kill() throws Throwable {
    Job job = createJobWithFileTransfers();
    JobId id = schedulerHelper.submitJob(job);
    log("Job submitted, id " + id.toString());
    log("Waiting for jobSubmitted Event");
    Job receivedJob = schedulerHelper.waitForEventJobSubmitted(id);
    assertEquals(receivedJob.getId(), id);
    log("Waiting for job running");
    JobInfo jInfo = schedulerHelper.waitForEventJobRunning(id);
    for (int i = 0; i < NB_TASKS; i++) {
        log("Waiting for task " + TASK_NAME + i + " running");
        schedulerHelper.waitForEventTaskRunning(id, TASK_NAME + i);
        log("Kill task " + TASK_NAME + i);
        try {
            schedulerHelper.killTask(id.toString(), TASK_NAME + i);
        } catch (Exception ignored) {
        // sometimes the job can be finished before all kill tasks messages are completed
        }
    }
    // Run it again and verify that it works without problem
    id = schedulerHelper.testJobSubmission(job);
    assertFalse("The job execution must not fail, check the node source log file : Node-local-" + JOB_NAME + ".log", schedulerHelper.getJobResult(id).hadException());
}
Also used : JobInfo(org.ow2.proactive.scheduler.common.job.JobInfo) Job(org.ow2.proactive.scheduler.common.job.Job) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JobId(org.ow2.proactive.scheduler.common.job.JobId) UserException(org.ow2.proactive.scheduler.common.exception.UserException) InvalidScriptException(org.ow2.proactive.scripting.InvalidScriptException) SchedulerFunctionalTest(functionaltests.utils.SchedulerFunctionalTest) Test(org.junit.Test)

Example 48 with JobInfo

use of org.ow2.proactive.scheduler.common.job.JobInfo in project scheduling by ow2-proactive.

the class TestKilledJobResult method test.

@Test
public void test() throws Throwable {
    TaskFlowJob job = new TaskFlowJob();
    JavaTask task1 = new JavaTask();
    task1.setName("task1");
    task1.setExecutableClassName(TestJavaTask1.class.getName());
    job.addTask(task1);
    JavaTask task2 = new JavaTask();
    task2.setName("task2");
    task2.setExecutableClassName(TestJavaTask2.class.getName());
    job.addTask(task2);
    task2.addDependence(task1);
    log("Submit job");
    JobId jobId = schedulerHelper.submitJob(job);
    log("Submitted job " + jobId);
    log("Waiting for task1 to finish");
    schedulerHelper.waitForEventTaskFinished(jobId, "task1");
    schedulerHelper.waitForEventTaskRunning(jobId, "task2");
    Scheduler scheduler = schedulerHelper.getSchedulerInterface();
    log("Killing job");
    scheduler.killJob(jobId);
    log("Wait when job finishes");
    schedulerHelper.waitForEventJobFinished(jobId);
    JobResult jobResult = scheduler.getJobResult(jobId);
    printResult(jobResult);
    assertEquals(1, jobResult.getAllResults().size());
    assertEquals("OK", jobResult.getAllResults().get("task1").value().toString());
    JobInfo jobInfo = jobResult.getJobInfo();
    assertEquals(JobStatus.KILLED, jobInfo.getStatus());
    assertEquals(1, jobInfo.getNumberOfFinishedTasks());
    assertEquals(2, jobInfo.getTotalNumberOfTasks());
    assertEquals(0, jobInfo.getNumberOfPendingTasks());
    assertEquals(0, jobInfo.getNumberOfRunningTasks());
    JobState state = scheduler.getJobState(jobId);
    assertEquals(JobStatus.KILLED, state.getStatus());
    assertEquals(1, state.getNumberOfFinishedTasks());
    assertEquals(2, state.getTotalNumberOfTasks());
    assertEquals(0, state.getNumberOfPendingTasks());
    assertEquals(0, state.getNumberOfRunningTasks());
    assertEquals(2, state.getTasks().size());
    assertEquals(TaskStatus.FINISHED, findTask(state, "task1").getStatus());
    assertEquals(TaskStatus.ABORTED, findTask(state, "task2").getStatus());
    TaskState taskState0 = state.getTasks().get(0);
    TaskState taskState1 = state.getTasks().get(1);
    assertTrue(taskState0.getStartTime() > 0);
    assertTrue(taskState0.getFinishedTime() > 0);
    assertTrue(taskState0.getExecutionDuration() >= 0);
    assertTrue(taskState0.getExecutionDuration() <= taskState0.getFinishedTime() - taskState0.getStartTime());
    assertTrue(taskState1.getStartTime() > 0);
    assertTrue(taskState1.getFinishedTime() > 0);
    assertTrue(taskState1.getExecutionDuration() >= 0);
    assertTrue(taskState1.getExecutionDuration() <= taskState1.getFinishedTime() - taskState1.getStartTime());
}
Also used : Scheduler(org.ow2.proactive.scheduler.common.Scheduler) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) TaskState(org.ow2.proactive.scheduler.common.task.TaskState) Test(org.junit.Test)

Example 49 with JobInfo

use of org.ow2.proactive.scheduler.common.job.JobInfo in project scheduling by ow2-proactive.

the class TestRamPolicy method testRamPolicy.

@Test
public void testRamPolicy() throws Throwable {
    Map<String, String> variables = new HashMap<String, String>();
    variables.put("MERGE_RAM", getHalfLocalRam());
    JobId jobId = schedulerHelper.submitJob(new File(jobDescriptor.toURI()).getAbsolutePath(), variables);
    log("Waiting for job finished");
    JobInfo jInfo = schedulerHelper.waitForEventJobFinished(jobId);
    JobResult res = schedulerHelper.getJobResult(jobId);
    assertThat(res.hadException(), is(false));
}
Also used : HashMap(java.util.HashMap) JobInfo(org.ow2.proactive.scheduler.common.job.JobInfo) JobResult(org.ow2.proactive.scheduler.common.job.JobResult) File(java.io.File) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 50 with JobInfo

use of org.ow2.proactive.scheduler.common.job.JobInfo in project scheduling by ow2-proactive.

the class TestRMReconnectionWhileRunning method assertJobFinished.

private void assertJobFinished(JobId jobId) throws Exception {
    final JobResult result0 = schedulerHelper.getJobResult(jobId);
    assertNotNull(result0);
    final JobInfo jobInfo0 = result0.getJobInfo();
    final JobStatus status0 = jobInfo0.getStatus();
    assertFalse(status0.isJobAlive());
}
Also used : JobStatus(org.ow2.proactive.scheduler.common.job.JobStatus) JobResult(org.ow2.proactive.scheduler.common.job.JobResult) JobInfo(org.ow2.proactive.scheduler.common.job.JobInfo)

Aggregations

JobInfo (org.ow2.proactive.scheduler.common.job.JobInfo)31 JobId (org.ow2.proactive.scheduler.common.job.JobId)20 Test (org.junit.Test)17 ArrayList (java.util.ArrayList)9 Scheduler (org.ow2.proactive.scheduler.common.Scheduler)9 TaskInfo (org.ow2.proactive.scheduler.common.task.TaskInfo)9 JobInfoImpl (org.ow2.proactive.scheduler.job.JobInfoImpl)9 JobState (org.ow2.proactive.scheduler.common.job.JobState)8 TaskState (org.ow2.proactive.scheduler.common.task.TaskState)8 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)8 TaskInfoImpl (org.ow2.proactive.scheduler.task.TaskInfoImpl)8 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)7 File (java.io.File)6 HashMap (java.util.HashMap)5 JobFilterCriteria (org.ow2.proactive.scheduler.common.JobFilterCriteria)5 NotConnectedException (org.ow2.proactive.scheduler.common.exception.NotConnectedException)5 PermissionException (org.ow2.proactive.scheduler.common.exception.PermissionException)5 JobResult (org.ow2.proactive.scheduler.common.job.JobResult)5 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)5 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)5