Search in sources :

Example 6 with InternalScriptTask

use of org.ow2.proactive.scheduler.task.internal.InternalScriptTask in project scheduling by ow2-proactive.

the class RecoveredSchedulerStateTest method createJob.

public InternalJob createJob(JobStatus jobStatus, int id) {
    InternalTaskFlowJob job = new InternalTaskFlowJob("MyJob", JobPriority.HIGH, OnTaskError.CANCEL_JOB, "Description");
    InternalScriptTask internalScriptTask = new InternalScriptTask(job);
    job.addTasks(ImmutableList.<InternalTask>of(internalScriptTask));
    job.setId(JobIdImpl.makeJobId("" + id));
    JobInfoImpl jobInfo = (JobInfoImpl) job.getJobInfo();
    jobInfo.setStatus(jobStatus);
    return job;
}
Also used : InternalScriptTask(org.ow2.proactive.scheduler.task.internal.InternalScriptTask) InternalTaskFlowJob(org.ow2.proactive.scheduler.job.InternalTaskFlowJob) JobInfoImpl(org.ow2.proactive.scheduler.job.JobInfoImpl)

Example 7 with InternalScriptTask

use of org.ow2.proactive.scheduler.task.internal.InternalScriptTask 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 8 with InternalScriptTask

use of org.ow2.proactive.scheduler.task.internal.InternalScriptTask 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 9 with InternalScriptTask

use of org.ow2.proactive.scheduler.task.internal.InternalScriptTask 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;
}
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 10 with InternalScriptTask

use of org.ow2.proactive.scheduler.task.internal.InternalScriptTask 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)

Aggregations

InternalScriptTask (org.ow2.proactive.scheduler.task.internal.InternalScriptTask)43 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)33 InternalTaskFlowJob (org.ow2.proactive.scheduler.job.InternalTaskFlowJob)32 Test (org.junit.Test)28 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)28 JobIdImpl (org.ow2.proactive.scheduler.job.JobIdImpl)25 JobId (org.ow2.proactive.scheduler.common.job.JobId)20 ArrayList (java.util.ArrayList)18 ExecuterInformation (org.ow2.proactive.scheduler.task.internal.ExecuterInformation)14 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)11 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 ScriptExecutableContainer (org.ow2.proactive.scheduler.task.containers.ScriptExecutableContainer)4 InternalForkedScriptTask (org.ow2.proactive.scheduler.task.internal.InternalForkedScriptTask)4 ProActiveTest (org.ow2.tests.ProActiveTest)4 InternalException (org.ow2.proactive.scheduler.common.exception.InternalException)3 JobCreationException (org.ow2.proactive.scheduler.common.exception.JobCreationException)3 ForkEnvironment (org.ow2.proactive.scheduler.common.task.ForkEnvironment)3