Search in sources :

Example 21 with InternalTaskFlowJob

use of org.ow2.proactive.scheduler.job.InternalTaskFlowJob 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, String sessionid) 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)

Example 22 with InternalTaskFlowJob

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

the class TerminationDataTest method testHandleTerminationForTaskNodeFailureTermination.

@Test
public void testHandleTerminationForTaskNodeFailureTermination() throws IOException, ClassNotFoundException {
    InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "description");
    JobId jobId = new JobIdImpl(666, "readableName");
    InternalTask internalTask = new InternalScriptTask(job);
    TaskId taskId = TaskIdImpl.createTaskId(jobId, "task-name", 777L);
    internalTask.setId(taskId);
    internalTask.setName("task-name");
    internalTask.setStatus(TaskStatus.RUNNING);
    internalTask.setExecuterInformation(Mockito.mock(ExecuterInformation.class));
    RunningTaskData taskData = new RunningTaskData(internalTask, "user", null, launcher);
    terminationData.addTaskData(null, taskData, TerminationData.TerminationStatus.NODEFAILED, null);
    terminationData.handleTermination(service);
    Mockito.verify(launcher, Mockito.times(0)).kill();
}
Also used : ExecuterInformation(org.ow2.proactive.scheduler.task.internal.ExecuterInformation) InternalScriptTask(org.ow2.proactive.scheduler.task.internal.InternalScriptTask) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) TaskId(org.ow2.proactive.scheduler.common.task.TaskId) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) 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 23 with InternalTaskFlowJob

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

the class TerminateReplicateTaskHandlerTest method generateInitiatorTask.

private InternalTask generateInitiatorTask() {
    InternalJob job = new InternalTaskFlowJob("initiator", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "description");
    InternalTask initiatorTask = new InternalScriptTask(job);
    initiatorTask.setId(TaskIdImpl.createTaskId(new JobIdImpl(666L, "JobName"), "readableName", 111L));
    initiatorTask.setReplicationIndex(1);
    return initiatorTask;
}
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)

Example 24 with InternalTaskFlowJob

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

the class LiveJobsTest method testUpdateStartAt.

@Test(timeout = 60000)
public void testUpdateStartAt() {
    String startAt = "2017-07-07T00:00:00+01:00";
    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);
    tasksList.add(internalTask);
    job.setTasks(tasksList);
    liveJobs.jobSubmitted(job);
    assertThat(liveJobs.updateStartAt(id, startAt), is(true));
}
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 25 with InternalTaskFlowJob

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

the class LiveJobsTest method testRestartTaskOnNodeRunning0ExecutionsLeft.

@Test(timeout = 60000)
public void testRestartTaskOnNodeRunning0ExecutionsLeft() throws UnknownJobException, UnknownTaskException {
    PASchedulerProperties.NUMBER_OF_EXECUTION_ON_FAILURE.updateProperty("0");
    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(false);
    liveJobs.taskStarted(job, job.getTask("task-name"), null);
    assertThat(internalTask.getMaxNumberOfExecutionOnFailure(), is(0));
    assertThat(internalTask.getTaskInfo().getNumberOfExecutionOnFailureLeft(), is(0));
    liveJobs.restartTaskOnNodeFailure(internalTask);
    internalTask.setStatus(TaskStatus.RUNNING);
    Mockito.verify(dbManager, Mockito.times(0)).taskRestarted(job, internalTask, null);
}
Also used : ExecuterInformation(org.ow2.proactive.scheduler.task.internal.ExecuterInformation) 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)

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