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());
}
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());
}
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());
}
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));
}
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());
}
Aggregations