use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.
the class LiveJobsTest method testTaskTerminatedWithResultSuspendTaskOnErrorLastExecution.
@Test(timeout = 60000)
public void testTaskTerminatedWithResultSuspendTaskOnErrorLastExecution() throws UnknownTaskException {
InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "description");
JobId id = new JobIdImpl(666L, "test-name");
job.setId(id);
List<InternalTask> tasksList = new ArrayList<>();
InternalTask internalTask = new InternalScriptTask(job);
TaskId taskId = TaskIdImpl.createTaskId(id, "task-name", 0L);
internalTask.setId(taskId);
internalTask.setName("task-name");
internalTask.setStatus(TaskStatus.RUNNING);
internalTask.setExecuterInformation(Mockito.mock(ExecuterInformation.class));
TaskInfoImpl taskInfoImpl = (TaskInfoImpl) internalTask.getTaskInfo();
taskInfoImpl.setNumberOfExecutionLeft(0);
internalTask.setOnTaskError(OnTaskError.PAUSE_TASK);
tasksList.add(internalTask);
job.setTasks(tasksList);
liveJobs.jobSubmitted(job);
liveJobs.lockJobsToSchedule();
liveJobs.taskStarted(job, job.getTask("task-name"), null);
TaskResultImpl result = new TaskResultImpl(taskId, new Exception(), null, 330);
liveJobs.taskTerminatedWithResult(taskId, result);
assertThat(taskInfoImpl.getNumberOfExecutionLeft(), is(-1));
assertThat(taskInfoImpl.getStatus(), is(TaskStatus.IN_ERROR));
assertThat(job.getStatus(), is(JobStatus.IN_ERROR));
}
use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.
the class LiveJobsTest method testRestartTaskOnNodeRunningDecreasingExecution.
@Test(timeout = 60000)
public void testRestartTaskOnNodeRunningDecreasingExecution() throws UnknownJobException, UnknownTaskException {
PASchedulerProperties.NUMBER_OF_EXECUTION_ON_FAILURE.updateProperty("5");
InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "description");
JobId id = new JobIdImpl(666L, "test-name");
job.setId(id);
List<InternalTask> tasksList = new ArrayList<>();
InternalScriptTask internalTask = new InternalScriptTask(job);
internalTask.setName("task-name");
internalTask.setStatus(TaskStatus.RUNNING);
internalTask.setMaxNumberOfExecution(5);
internalTask.setExecuterInformation(Mockito.mock(ExecuterInformation.class));
tasksList.add(internalTask);
job.setTasks(tasksList);
liveJobs.jobSubmitted(job);
liveJobs.lockJobsToSchedule();
liveJobs.taskStarted(job, job.getTask("task-name"), null);
assertThat(internalTask.getMaxNumberOfExecutionOnFailure(), is(5));
assertThat(internalTask.getTaskInfo().getNumberOfExecutionOnFailureLeft(), is(5));
liveJobs.restartTaskOnNodeFailure(internalTask);
internalTask.setStatus(TaskStatus.RUNNING);
assertThat(internalTask.getMaxNumberOfExecutionOnFailure(), is(5));
assertThat(internalTask.getTaskInfo().getNumberOfExecutionOnFailureLeft(), is(4));
Mockito.verify(dbManager, Mockito.times(1)).taskRestarted(job, internalTask, null);
}
use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.
the class LiveJobsTest method testRestartTaskOnNodeFailureRunningExceptionExpectedBecauseNotLockedTask.
@Test(expected = IllegalStateException.class, timeout = 60000)
public void testRestartTaskOnNodeFailureRunningExceptionExpectedBecauseNotLockedTask() throws UnknownJobException, UnknownTaskException {
InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "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.RUNNING);
tasksList.add(internalTask);
job.setTasks(tasksList);
liveJobs.jobSubmitted(job);
liveJobs.restartTaskOnNodeFailure(internalTask);
}
use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.
the class TagTest method testReplicationReplicateCombinedTag.
@Test
public void testReplicationReplicateCombinedTag() throws Exception {
InternalTask T = createReplicateTask("T", null, FlowBlock.START, "T2", 3);
InternalTask T1 = createTask("T1", new InternalTask[] { T }, FlowBlock.START, "T5");
InternalTask T3 = createTask("T3", new InternalTask[] { T1 }, null, null);
InternalTask T4 = createTask("T4", new InternalTask[] { T1 }, null, null);
InternalTask T5 = createTask("T5", new InternalTask[] { T3, T4 }, FlowBlock.END, "T1");
InternalTask T2 = createLoopTask("T2", "loop = true;", new InternalTask[] { T5 }, "T", true);
execute(new String[] { "T", "T1", "T3", "T4", "T5", "T1*1", "T3*1", "T4*1", "T5*1", "T1*2", "T3*2", "T4*2", "T5*2", "T2", "T#1", "T1#1", "T3#1", "T4#1", "T5#1", "T1#1*1", "T3#1*1", "T4#1*1", "T5#1*1", "T1#1*2", "T3#1*2", "T4#1*2", "T5#1*2" });
assertTags("REPLICATE-T-1", new String[] { "T1*1", "T3*1", "T4*1", "T5*1" });
assertTags("REPLICATE-T-2", new String[] { "T1*2", "T3*2", "T4*2", "T5*2" });
assertTags("LOOP-T2-1", new String[] { "T#1", "T1#1", "T3#1", "T4#1", "T5#1" });
assertTags("REPLICATE-T#1-1", new String[] { "T1#1*1", "T3#1*1", "T4#1*1", "T5#1*1" });
assertTags("REPLICATE-T#1-2", new String[] { "T1#1*2", "T3#1*2", "T4#1*2", "T5#1*2" });
}
use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.
the class TagTest method execute.
private void execute(String[] tasks) throws UnknownTaskException {
for (String currentTaskName : tasks) {
InternalTask currentTask = job.getTask(currentTaskName);
execute(currentTask);
}
}
Aggregations