Search in sources :

Example 36 with InternalJob

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

the class BaseSchedulerDBTest method saveSingleTask.

public InternalJob saveSingleTask(Task task) throws Exception {
    TaskFlowJob job = new TaskFlowJob();
    job.addTask(task);
    InternalJob jobData = defaultSubmitJobAndLoadInternal(true, job);
    Assert.assertEquals(1, jobData.getTasks().size());
    return jobData;
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob)

Example 37 with InternalJob

use of org.ow2.proactive.scheduler.job.InternalJob 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);
}
Also used : TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask)

Example 38 with InternalJob

use of org.ow2.proactive.scheduler.job.InternalJob 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());
}
Also used : RecoveredSchedulerState(org.ow2.proactive.scheduler.core.db.RecoveredSchedulerState) TaskDescriptor(org.ow2.proactive.scheduler.common.TaskDescriptor) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) SchedulerStateRecoverHelper(org.ow2.proactive.scheduler.core.db.SchedulerStateRecoverHelper) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) Test(org.junit.Test)

Example 39 with InternalJob

use of org.ow2.proactive.scheduler.job.InternalJob 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);
}
Also used : RecoveredSchedulerState(org.ow2.proactive.scheduler.core.db.RecoveredSchedulerState) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) ExecutableContainer(org.ow2.proactive.scheduler.task.containers.ExecutableContainer) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) SchedulerStateRecoverHelper(org.ow2.proactive.scheduler.core.db.SchedulerStateRecoverHelper) Test(org.junit.Test)

Example 40 with InternalJob

use of org.ow2.proactive.scheduler.job.InternalJob 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);
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) FileSelector(org.objectweb.proactive.extensions.dataspaces.vfs.selector.FileSelector) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) Test(org.junit.Test)

Aggregations

InternalJob (org.ow2.proactive.scheduler.job.InternalJob)166 Test (org.junit.Test)115 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)90 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)53 JobIdImpl (org.ow2.proactive.scheduler.job.JobIdImpl)36 InternalTaskFlowJob (org.ow2.proactive.scheduler.job.InternalTaskFlowJob)34 InternalScriptTask (org.ow2.proactive.scheduler.task.internal.InternalScriptTask)33 TaskResultImpl (org.ow2.proactive.scheduler.task.TaskResultImpl)32 JobId (org.ow2.proactive.scheduler.common.job.JobId)28 ArrayList (java.util.ArrayList)27 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)26 JavaTask (org.ow2.proactive.scheduler.common.task.JavaTask)19 RecoveredSchedulerState (org.ow2.proactive.scheduler.core.db.RecoveredSchedulerState)19 Matchers.containsString (org.hamcrest.Matchers.containsString)16 Matchers.anyString (org.mockito.Matchers.anyString)16 ExecuterInformation (org.ow2.proactive.scheduler.task.internal.ExecuterInformation)15 UnknownTaskException (org.ow2.proactive.scheduler.common.exception.UnknownTaskException)13 SchedulerStateRecoverHelper (org.ow2.proactive.scheduler.core.db.SchedulerStateRecoverHelper)12 TaskInfoImpl (org.ow2.proactive.scheduler.task.TaskInfoImpl)12 HashMap (java.util.HashMap)10