use of org.ow2.proactive.scheduler.common.task.TaskState in project scheduling by ow2-proactive.
the class TestGenericInformation method testWithReplication.
public void testWithReplication() throws Throwable {
JobId jobId = schedulerHelper.submitJob(createJobWithReplication());
SchedulerTHelper.log("Job submitted, id " + jobId.toString());
schedulerHelper.waitForEventJobFinished(jobId);
Scheduler scheduler = schedulerHelper.getSchedulerInterface();
JobState js = scheduler.getJobState(jobId);
for (TaskState taskState : js.getTasks()) {
checkTaskState(taskState);
}
}
use of org.ow2.proactive.scheduler.common.task.TaskState in project scheduling by ow2-proactive.
the class TestTaskIdOrderSameAsDeclarationOrder method task_ids_should_be_ordered_as_task_declaration_order.
@Test
public void task_ids_should_be_ordered_as_task_declaration_order() throws Throwable {
TaskFlowJob job = (TaskFlowJob) StaxJobFactory.getFactory().createJob(new File(jobDescriptor.toURI()).getAbsolutePath());
JobId id = schedulerHelper.submitJob(job);
JobState jobState = schedulerHelper.waitForEventJobSubmitted(id);
List<TaskState> sortedTasksById = sortTasksById(jobState);
assertEquals("premiere", sortedTasksById.get(0).getName());
assertEquals("deuxieme", sortedTasksById.get(1).getName());
assertEquals("troisieme", sortedTasksById.get(2).getName());
// remove job
schedulerHelper.waitForEventJobFinished(id);
schedulerHelper.removeJob(id);
schedulerHelper.waitForEventJobRemoved(id);
}
use of org.ow2.proactive.scheduler.common.task.TaskState in project scheduling by ow2-proactive.
the class TestJobServerLogs method checkNoLogsFromAPI.
private void checkNoLogsFromAPI(JobId jobId, List<TaskState> tasks) throws Exception {
Scheduler scheduler = schedulerHelper.getSchedulerInterface();
try {
scheduler.getJobServerLogs(jobId.toString());
fail("getJobServerLogs should throw an exception for a removed job");
} catch (UnknownJobException expected) {
}
for (TaskState taskState : tasks) {
try {
scheduler.getTaskServerLogs(jobId.toString(), taskState.getName());
fail("getTaskServerLogs should throw an exception for a removed job");
} catch (UnknownJobException expected) {
}
}
}
use of org.ow2.proactive.scheduler.common.task.TaskState in project scheduling by ow2-proactive.
the class TestJobServerLogs method checkRemoval.
public void checkRemoval(JobId jobId) throws Exception {
JobState jobState = schedulerHelper.getSchedulerInterface().getJobState(jobId);
List<TaskState> tasks = jobState.getTasks();
checkJobAndTaskLogFiles(jobId, tasks, true);
// Before it was only job removal but it was bug prone (for pendingJob only)
// because the following sequence of the events could happen:
// 1. SchedulerMethodImpl main loop retrieves info about this forever pending job
// 2. we call removeJob
// 3. SchedulerMethodImpl main loop asks for RM::getRMNodes.
//
// Third action would print "[SelectionManager.doSelectNodes] "scheduler"..." to the task log
// which would actually re-created removed log file which would cause an error
// in the last line of this method
// that is why kill the job and after wait 5s to make sure that
// iteration of SchedulerMethodImpl main loop is finished,
// and finally, we remove job with its log files.
schedulerHelper.killJob(jobId.value());
Thread.sleep(5000);
schedulerHelper.removeJob(jobId);
schedulerHelper.waitForEventJobRemoved(jobId);
System.out.println("Suppose to remove all logs at " + simpleDateFormat.format(new Date()));
checkNoLogsFromAPI(jobId, tasks);
checkJobAndTaskLogFiles(jobId, tasks, false);
}
use of org.ow2.proactive.scheduler.common.task.TaskState in project scheduling by ow2-proactive.
the class TestJobSchedulingStarvationAndPriority method computeMinMaxStartingTime.
/**
* Computes min start time and max start time for all tasks which match a given pattern
* If a task in the set did not start, then the set max will be Long.MAX_VALUE
*/
Pair<Long, Long> computeMinMaxStartingTime(Scheduler scheduler, JobId jobId, String taskNameFilter) throws Exception {
long min = Long.MAX_VALUE;
long max = -1;
for (TaskState state : scheduler.getJobState(jobId).getTasks()) {
if (state.getName().matches(taskNameFilter)) {
long startTime = state.getStartTime() > -1 ? state.getStartTime() : Long.MAX_VALUE;
min = Math.min(min, startTime);
max = Math.max(max, startTime);
}
}
return new ImmutablePair<>(min, max);
}
Aggregations