Search in sources :

Example 16 with InternalTaskFlowJob

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

the class LiveJobsTest method testFinishInErrorTaskDoesNotFinishPendingTask.

@Test(timeout = 60000)
public void testFinishInErrorTaskDoesNotFinishPendingTask() throws UnknownTaskException, UnknownJobException {
    InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CONTINUE_JOB_EXECUTION, "description");
    JobId id = new JobIdImpl(666L, "test-name");
    job.setId(id);
    List<InternalTask> tasksList = new ArrayList<>();
    InternalTask internalTask = new InternalScriptTask(job);
    internalTask.setName("task-name");
    internalTask.setStatus(TaskStatus.PENDING);
    tasksList.add(internalTask);
    job.setTasks(tasksList);
    liveJobs.jobSubmitted(job);
    liveJobs.finishInErrorTask(job.getId(), "task-name");
    assertThat(internalTask.getStatus(), is(TaskStatus.PENDING));
}
Also used : InternalScriptTask(org.ow2.proactive.scheduler.task.internal.InternalScriptTask) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) ArrayList(java.util.ArrayList) JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) InternalTaskFlowJob(org.ow2.proactive.scheduler.job.InternalTaskFlowJob) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 17 with InternalTaskFlowJob

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

the class SchedulingServiceTest method testRestartTaskOnNodeFailure.

@Test
public void testRestartTaskOnNodeFailure() {
    InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "description");
    InternalTask task = new InternalScriptTask(job);
    ExecutorService executorService = Mockito.mock(ExecutorService.class);
    Mockito.when(infrastructure.getInternalOperationsThreadPool()).thenReturn(executorService);
    schedulingService.restartTaskOnNodeFailure(task);
    Mockito.verify(executorService, Mockito.times(1)).submit(any(Runnable.class));
}
Also used : InternalScriptTask(org.ow2.proactive.scheduler.task.internal.InternalScriptTask) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) ExecutorService(java.util.concurrent.ExecutorService) InternalTaskFlowJob(org.ow2.proactive.scheduler.job.InternalTaskFlowJob) Test(org.junit.Test)

Example 18 with InternalTaskFlowJob

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

the class ExtendedSchedulerPolicyTest method createTask.

private InternalScriptTask createTask(String taskStartAt) {
    InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "description");
    InternalScriptTask task1 = new InternalScriptTask(job);
    if (taskStartAt != null) {
        task1.addGenericInformation("START_AT", taskStartAt);
    }
    return task1;
}
Also used : InternalScriptTask(org.ow2.proactive.scheduler.task.internal.InternalScriptTask) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) InternalTaskFlowJob(org.ow2.proactive.scheduler.job.InternalTaskFlowJob)

Example 19 with InternalTaskFlowJob

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

the class ExtendedSchedulerPolicyTest method createJobDescWithTwoTasks.

private JobDescriptor createJobDescWithTwoTasks(String jobStartAt, String oneTaskStartAt, String otherTaskStartAt) {
    InternalTaskFlowJob taskFlowJob = new InternalTaskFlowJob("test", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "");
    taskFlowJob.setId(JobIdImpl.makeJobId(Integer.toString(jobId++)));
    ArrayList<InternalTask> tasks = new ArrayList<>();
    tasks.add(createTask(oneTaskStartAt));
    tasks.add(createTask(otherTaskStartAt));
    taskFlowJob.addTasks(tasks);
    if (jobStartAt != null) {
        taskFlowJob.addGenericInformation("START_AT", jobStartAt);
    }
    return new JobDescriptorImpl(taskFlowJob);
}
Also used : InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) ArrayList(java.util.ArrayList) InternalTaskFlowJob(org.ow2.proactive.scheduler.job.InternalTaskFlowJob) JobDescriptorImpl(org.ow2.proactive.scheduler.descriptor.JobDescriptorImpl)

Example 20 with InternalTaskFlowJob

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

the class TerminateReplicateTaskHandlerTest method generateInternalTask.

private InternalTask generateInternalTask(long id) {
    InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "description");
    InternalTask internalTask = new InternalScriptTask(job);
    internalTask.setId(TaskIdImpl.createTaskId(new JobIdImpl(666L, "JobName"), "test-name-" + id, id));
    internalTask.setName("test-name-" + id);
    internalTask.setStatus(TaskStatus.PENDING);
    return internalTask;
}
Also used : InternalScriptTask(org.ow2.proactive.scheduler.task.internal.InternalScriptTask) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) InternalTaskFlowJob(org.ow2.proactive.scheduler.job.InternalTaskFlowJob)

Aggregations

InternalTaskFlowJob (org.ow2.proactive.scheduler.job.InternalTaskFlowJob)39 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)33 InternalScriptTask (org.ow2.proactive.scheduler.task.internal.InternalScriptTask)33 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)30 Test (org.junit.Test)27 JobIdImpl (org.ow2.proactive.scheduler.job.JobIdImpl)27 JobId (org.ow2.proactive.scheduler.common.job.JobId)22 ArrayList (java.util.ArrayList)20 ExecuterInformation (org.ow2.proactive.scheduler.task.internal.ExecuterInformation)14 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)10 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)5 UnknownTaskException (org.ow2.proactive.scheduler.common.exception.UnknownTaskException)5 TaskInfoImpl (org.ow2.proactive.scheduler.task.TaskInfoImpl)5 TaskResultImpl (org.ow2.proactive.scheduler.task.TaskResultImpl)5 InputStream (java.io.InputStream)3 JobInfoImpl (org.ow2.proactive.scheduler.job.JobInfoImpl)3 File (java.io.File)2 LinkedHashMap (java.util.LinkedHashMap)2 Node (org.objectweb.proactive.core.node.Node)2 SchedulerDBManager (org.ow2.proactive.scheduler.core.db.SchedulerDBManager)2