use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId 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"), "readableName", id));
internalTask.setStatus(TaskStatus.PENDING);
return internalTask;
}
use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.
the class TaskLoggerTest method testGetJobLogFilename.
@Test
public void testGetJobLogFilename() {
JobId jobId = new JobIdImpl(1123, "readableName");
TaskId taskId = TaskIdImpl.createTaskId(jobId, "taskreadableName", 123123);
assertThat(TaskLogger.getTaskLogRelativePath(taskId), is("1123/1123t123123"));
}
use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.
the class LiveJobsTest method testTaskTerminatedWithResultPauseJobOnError.
@Test(timeout = 60000)
public void testTaskTerminatedWithResultPauseJobOnError() 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(10);
internalTask.setOnTaskError(OnTaskError.PAUSE_JOB);
InternalTask internalTask2 = new InternalScriptTask(job);
TaskId taskId2 = TaskIdImpl.createTaskId(id, "task-name2", 1L);
internalTask2.setId(taskId2);
internalTask2.setName("task-name2");
internalTask2.setStatus(TaskStatus.RUNNING);
internalTask2.setExecuterInformation(Mockito.mock(ExecuterInformation.class));
TaskInfoImpl taskInfoImpl2 = (TaskInfoImpl) internalTask2.getTaskInfo();
taskInfoImpl2.setNumberOfExecutionLeft(10);
internalTask2.setOnTaskError(OnTaskError.NONE);
tasksList.add(internalTask);
tasksList.add(internalTask2);
job.setTasks(tasksList);
liveJobs.jobSubmitted(job);
liveJobs.lockJobsToSchedule();
liveJobs.taskStarted(job, job.getTask("task-name"), null);
TaskResultImpl result = new TaskResultImpl(taskId, new Exception());
liveJobs.taskTerminatedWithResult(taskId, result);
assertThat(taskInfoImpl.getNumberOfExecutionLeft(), is(9));
assertThat(taskInfoImpl.getStatus(), is(TaskStatus.WAITING_ON_ERROR));
assertThat(taskInfoImpl2.getNumberOfExecutionLeft(), is(10));
assertThat(taskInfoImpl2.getStatus(), is(TaskStatus.PENDING));
assertThat(job.getStatus(), is(JobStatus.STALLED));
}
use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.
the class LiveJobsTest method testTaskTerminatedWithResultContinueJobOnError.
@Test(timeout = 60000)
public void testTaskTerminatedWithResultContinueJobOnError() 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(2);
internalTask.setOnTaskError(OnTaskError.CONTINUE_JOB_EXECUTION);
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());
liveJobs.taskTerminatedWithResult(taskId, result);
assertThat(taskInfoImpl.getNumberOfExecutionLeft(), is(1));
assertThat(taskInfoImpl.getStatus(), is(TaskStatus.WAITING_ON_ERROR));
assertThat(job.getStatus(), is(JobStatus.STALLED));
}
use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.
the class LiveJobsTest method testTaskTerminatedWithResultCancelJobOnError.
@Test(timeout = 60000)
public void testTaskTerminatedWithResultCancelJobOnError() 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(1);
internalTask.setOnTaskError(OnTaskError.CANCEL_JOB);
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());
liveJobs.taskTerminatedWithResult(taskId, result);
assertThat(taskInfoImpl.getNumberOfExecutionLeft(), is(0));
assertThat(taskInfoImpl.getStatus(), is(TaskStatus.FAULTY));
assertThat(job.getStatus(), is(JobStatus.CANCELED));
}
Aggregations