use of org.ow2.proactive.scheduler.common.task.Task in project scheduling by ow2-proactive.
the class SchedulerDbManagerConcurrencyTest method createAndInsertJob.
public InternalJob createAndInsertJob() throws Exception {
TaskFlowJob jobDef = new TaskFlowJob();
JavaTask javaTask = createDefaultTask("java task");
javaTask.setExecutableClassName(TestDummyExecutable.class.getName());
jobDef.addTask(javaTask);
return defaultSubmitJob(jobDef);
}
use of org.ow2.proactive.scheduler.common.task.Task in project scheduling by ow2-proactive.
the class SchedulerTasksStateRecoverIntegrationTest method testRecover.
@Test
public void testRecover() throws Exception {
SchedulerStateRecoverHelper recoverHelper = new SchedulerStateRecoverHelper(dbManager);
RecoveredSchedulerState state = recoverHelper.recover(-1);
Assert.assertEquals(0, state.getFinishedJobs().size());
Assert.assertEquals(0, state.getRunningJobs().size());
Assert.assertEquals(0, state.getPendingJobs().size());
TaskFlowJob job1 = new TaskFlowJob();
JavaTask task1 = createDefaultTask("task1");
JavaTask task2 = createDefaultTask("task2");
JavaTask task3 = createDefaultTask("task3");
task1.addDependence(task2);
task1.addDependence(task3);
task2.addDependence(task3);
job1.addTask(task1);
job1.addTask(task2);
job1.addTask(task3);
InternalJob job = defaultSubmitJob(job1);
JobStateMatcher expectedJob;
expectedJob = job(job.getId(), JobStatus.PENDING).withPending(task("task1", TaskStatus.SUBMITTED), false).withPending(task("task2", TaskStatus.SUBMITTED), false).withPending(task("task3", TaskStatus.SUBMITTED), false).withEligible("task3");
state = checkRecoveredState(recoverHelper.recover(-1), state().withPending(expectedJob));
job = state.getPendingJobs().get(0);
TaskDescriptor task = job.getJobDescriptor().getEligibleTasks().iterator().next();
Assert.assertEquals(2, task.getChildren().size());
Assert.assertEquals(0, task.getParents().size());
job.terminate();
dbManager.updateAfterTaskFinished(job, null, null);
expectedJob = job(job.getId(), JobStatus.FINISHED).withPending(task("task1", TaskStatus.SUBMITTED), false).withPending(task("task2", TaskStatus.SUBMITTED), false).withPending(task("task3", TaskStatus.SUBMITTED), false).withEligible("task3");
state = checkRecoveredState(recoverHelper.recover(-1), state().withFinished(expectedJob));
job = state.getFinishedJobs().get(0);
task = job.getJobDescriptor().getEligibleTasks().iterator().next();
Assert.assertEquals(2, task.getChildren().size());
Assert.assertEquals(0, task.getParents().size());
}
use of org.ow2.proactive.scheduler.common.task.Task in project scheduling by ow2-proactive.
the class SchedulerTasksStateRecoverIntegrationTest method testRecoverAfterRestart.
@Test
public void testRecoverAfterRestart() throws Exception {
TaskFlowJob jobDef = new TaskFlowJob();
jobDef.addTask(createDefaultTask("task1"));
InternalJob job = defaultSubmitJobAndLoadInternal(true, jobDef);
InternalTask task = job.getTask("task1");
job.start();
startTask(job, task);
dbManager.jobTaskStarted(job, task, true);
SchedulerStateRecoverHelper recoverHelper = new SchedulerStateRecoverHelper(dbManager);
JobStateMatcher expectedJob;
expectedJob = job(job.getId(), JobStatus.STALLED).withPending(task("task1", TaskStatus.PENDING), true).withEligible("task1");
RecoveredSchedulerState state;
state = checkRecoveredState(recoverHelper.recover(-1), state().withRunning(expectedJob));
job = state.getRunningJobs().get(0);
task = job.getTask("task1");
startTask(job, task);
dbManager.jobTaskStarted(job, task, true);
job.newWaitingTask();
job.reStartTask(task);
dbManager.taskRestarted(job, task, null);
state = checkRecoveredState(recoverHelper.recover(-1), state().withRunning(expectedJob));
// check it is possible to load ExecutableContainer for restored task
job = state.getRunningJobs().get(0);
ExecutableContainer container = dbManager.loadExecutableContainer(job.getTask("task1"));
Assert.assertNotNull(container);
}
use of org.ow2.proactive.scheduler.common.task.Task in project scheduling by ow2-proactive.
the class TestDataspaceSelectorsData method testSelectors.
@Test
public void testSelectors() throws Exception {
TaskFlowJob jobDef = new TaskFlowJob();
JavaTask task = createDefaultTask("task1");
Set<String> inInclude1 = Sets.newHashSet("inInclude1_1", "inInclude1_2");
Set<String> inExclude1 = Sets.newHashSet("inExclude1_1", "inExclude1_2");
Set<String> outInclude1 = Sets.newHashSet("outInclude1_1", "outInclude1_2");
Set<String> outExclude1 = Sets.newHashSet("outExclude1_1", "outExclude1_2");
Set<String> inInclude2 = Sets.newHashSet("inInclude" + createString(500));
Set<String> inExclude2 = Sets.newHashSet("inExclude" + createString(500));
Set<String> outInclude2 = Sets.newHashSet("outInclude" + createString(500));
Set<String> outExclude2 = Sets.newHashSet("outExclude" + createString(500));
FileSelector fileSelector;
task.addInputFiles(new FileSelector(inInclude1, inExclude1), InputAccessMode.TransferFromGlobalSpace);
task.addInputFiles(new FileSelector(inInclude1, inExclude1), InputAccessMode.TransferFromUserSpace);
fileSelector = new FileSelector(inInclude2, inExclude2);
task.addInputFiles(fileSelector, InputAccessMode.TransferFromInputSpace);
task.addOutputFiles(new FileSelector(outInclude1, outExclude1), OutputAccessMode.TransferToGlobalSpace);
task.addOutputFiles(new FileSelector(outInclude1, outExclude1), OutputAccessMode.TransferToUserSpace);
fileSelector = new FileSelector(outInclude2, outExclude2);
task.addOutputFiles(fileSelector, OutputAccessMode.TransferToOutputSpace);
jobDef.addTask(task);
InternalJob job = defaultSubmitJobAndLoadInternal(true, jobDef);
InternalTask task1 = job.getTask("task1");
Assert.assertEquals(3, task1.getInputFilesList().size());
Assert.assertEquals(InputAccessMode.TransferFromGlobalSpace, task1.getInputFilesList().get(0).getMode());
Assert.assertEquals(InputAccessMode.TransferFromUserSpace, task1.getInputFilesList().get(1).getMode());
Assert.assertEquals(3, task1.getOutputFilesList().size());
checkSelector(task1.getInputFilesList().get(0).getInputFiles(), inInclude1, inExclude1, true);
checkSelector(task1.getInputFilesList().get(1).getInputFiles(), inInclude1, inExclude1, true);
checkSelector(task1.getInputFilesList().get(2).getInputFiles(), inInclude2, inExclude2, false);
checkSelector(task1.getOutputFilesList().get(0).getOutputFiles(), outInclude1, outExclude1, true);
checkSelector(task1.getOutputFilesList().get(1).getOutputFiles(), outInclude1, outExclude1, true);
checkSelector(task1.getOutputFilesList().get(2).getOutputFiles(), outInclude2, outExclude2, false);
}
use of org.ow2.proactive.scheduler.common.task.Task in project scheduling by ow2-proactive.
the class TestJobAttributes method testJobIdGeneration.
@Test
public void testJobIdGeneration() throws Exception {
// test job ids are sequential
for (int i = 0; i < 5; i++) {
TaskFlowJob jobDef = new TaskFlowJob();
for (int j = 0; j < 10; j++) {
jobDef.addTask(createDefaultTask("task" + j));
}
InternalJob job = defaultSubmitJob(jobDef);
Assert.assertEquals(String.valueOf(i + 1), job.getId().value());
}
}
Aggregations