Search in sources :

Example 81 with InternalJob

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

the class SchedulerDBManagerTest method terminateJob.

private void terminateJob(int jobIndex, long finishedTime) throws Throwable {
    InternalJob finishedJob = actualInternalJobs.get(jobIndex);
    finishedJob.start();
    finishedJob.terminate();
    for (InternalTask task : finishedJob.getITasks()) {
        TaskResultImpl result = new TaskResultImpl(task.getId(), "ok", null, 0);
        FlowAction action = new FlowAction(FlowActionType.CONTINUE);
        ChangedTasksInfo changesInfo = finishedJob.terminateTask(false, task.getId(), null, action, result);
        task.setFinishedTime(finishedTime);
        dbManager.updateAfterWorkflowTaskFinished(finishedJob, changesInfo, result);
    }
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) ChangedTasksInfo(org.ow2.proactive.scheduler.job.ChangedTasksInfo) TaskResultImpl(org.ow2.proactive.scheduler.task.TaskResultImpl) FlowAction(org.ow2.proactive.scheduler.common.task.flow.FlowAction) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask)

Example 82 with InternalJob

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

the class SchedulerDbManagerRecoveryTest method testJobRecoveryWithIfInALoop.

/**
 * Regression test related to issue #1988:
 * <p>
 * https://github.com/ow2-proactive/scheduling/issues/1988
 */
@Test
public void testJobRecoveryWithIfInALoop() throws Exception {
    InternalJob reloadedJob = testJobRecovery("flow_if_in_a_loop.xml");
    // joined branches should be saved and restored
    InternalTask task = reloadedJob.getTask("Loop");
    assertThat(task).isNotNull();
    assertThat(task.getJoinedBranches()).isNotEmpty();
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) Test(org.junit.Test) ProActiveTest(org.ow2.tests.ProActiveTest)

Example 83 with InternalJob

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

the class SchedulerDbManagerRecoveryTest method testJobRecovery.

private InternalJob testJobRecovery(String workflowFilename) throws Exception {
    Job job = Jobs.parseXml(this.getClass().getResource("/functionaltests/workflow/descriptors/" + workflowFilename).getPath());
    InternalJob submittedJob = Jobs.createJob(job);
    dbManager.newJobSubmitted(submittedJob);
    closeAndRestartDatabase();
    List<InternalJob> internalJobs = dbManager.loadJobs(true, submittedJob.getId());
    assertThat(internalJobs).hasSize(1);
    InternalJob loadedJob = internalJobs.get(0);
    loadedJob.equals(submittedJob);
    assertThat(Jobs.areEqual(submittedJob, loadedJob)).isTrue();
    return loadedJob;
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) Job(org.ow2.proactive.scheduler.common.job.Job) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob)

Example 84 with InternalJob

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

the class SchedulingServiceTest2 method testNotStartedJob.

@Test
public void testNotStartedJob() throws Exception {
    InternalJob job = createJob(createTestJob());
    service.submitJob(job);
    listener.assertEvents(SchedulerEvent.JOB_SUBMITTED);
    service.killJob(job.getId());
    listener.assertEvents(SchedulerEvent.TASK_RUNNING_TO_FINISHED, SchedulerEvent.TASK_RUNNING_TO_FINISHED, SchedulerEvent.JOB_PENDING_TO_FINISHED, SchedulerEvent.JOB_UPDATED);
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) Test(org.junit.Test)

Example 85 with InternalJob

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

the class OnErrorPolicyInterpreterTest method createTask.

private InternalTask createTask() {
    InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "description");
    InternalTask task = new InternalTask(job) {

        @Override
        public boolean handleResultsArguments() {
            // TODO Auto-generated method stub
            return false;
        }

        @Override
        public TaskLauncher createLauncher(Node node) throws ActiveObjectCreationException, NodeException {
            // TODO Auto-generated method stub
            return null;
        }
    };
    return task;
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) Node(org.objectweb.proactive.core.node.Node) InternalTaskFlowJob(org.ow2.proactive.scheduler.job.InternalTaskFlowJob)

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