Search in sources :

Example 61 with JobIdImpl

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

the class TerminationDataTest method testAddTaskData.

@Test
public void testAddTaskData() {
    assertThat(terminationData.isEmpty(), is(true));
    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, null);
    terminationData.addTaskData(null, taskData, TerminationData.TerminationStatus.NORMAL, null);
    assertThat(terminationData.isEmpty(), is(false));
    assertThat(terminationData.taskTerminated(jobId, "task-name"), is(true));
}
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 62 with JobIdImpl

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

the class TerminationDataTest method testAddRestartData.

@Test
public void testAddRestartData() {
    assertThat(terminationData.isEmpty(), is(true));
    JobId jobId = new JobIdImpl(666, "readableName");
    TaskId taskId = TaskIdImpl.createTaskId(jobId, "task-name", 777L);
    terminationData.addRestartData(taskId, 1000L);
    assertThat(terminationData.isEmpty(), is(false));
}
Also used : TaskId(org.ow2.proactive.scheduler.common.task.TaskId) JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 63 with JobIdImpl

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

the class TerminationDataTest method testHandleTerminationForTaskToRestart.

@Test
public void testHandleTerminationForTaskToRestart() throws RMProxyCreationException, IOException, ClassNotFoundException {
    JobId jobId = new JobIdImpl(666, "readableName");
    TaskId taskId = TaskIdImpl.createTaskId(jobId, "task-name", 777L);
    terminationData.addRestartData(taskId, 1000L);
    terminationData.handleTermination(service);
    Mockito.verify(schedulingInfrastructure, Mockito.times(1)).schedule(org.mockito.Matchers.any(Runnable.class), org.mockito.Matchers.anyLong());
}
Also used : TaskId(org.ow2.proactive.scheduler.common.task.TaskId) JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 64 with JobIdImpl

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

the class TerminationDataTest method testHandleTerminationForTaskNormalTermination.

@Test
public void testHandleTerminationForTaskNormalTermination() throws RMProxyCreationException, 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.NORMAL, null);
    terminationData.handleTermination(service);
    Mockito.verify(proxiesManager, Mockito.times(1)).getUserRMProxy("user", null);
    Mockito.verify(rmProxy, Mockito.times(1)).releaseNodes(org.mockito.Matchers.any(NodeSet.class), org.mockito.Matchers.any(org.ow2.proactive.scripting.Script.class), Mockito.any(VariablesMap.class), Mockito.any(HashMap.class), Mockito.any(TaskId.class), Mockito.any(Credentials.class));
}
Also used : ExecuterInformation(org.ow2.proactive.scheduler.task.internal.ExecuterInformation) NodeSet(org.ow2.proactive.utils.NodeSet) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) TaskId(org.ow2.proactive.scheduler.common.task.TaskId) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) HashMap(java.util.HashMap) InternalScriptTask(org.ow2.proactive.scheduler.task.internal.InternalScriptTask) VariablesMap(org.ow2.proactive.scheduler.task.utils.VariablesMap) JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) InternalTaskFlowJob(org.ow2.proactive.scheduler.job.InternalTaskFlowJob) JobId(org.ow2.proactive.scheduler.common.job.JobId) Credentials(org.ow2.proactive.authentication.crypto.Credentials) Test(org.junit.Test)

Example 65 with JobIdImpl

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

the class TerminationDataTest method testHandleTerminationForJob.

@Test
public void testHandleTerminationForJob() throws IOException, ClassNotFoundException {
    JobId jobId = new JobIdImpl(666, "readableName");
    terminationData.addJobToTerminate(jobId);
    terminationData.handleTermination(service);
    Mockito.verify(service, Mockito.times(1)).terminateJobHandling(jobId);
}
Also used : JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Aggregations

JobIdImpl (org.ow2.proactive.scheduler.job.JobIdImpl)85 Test (org.junit.Test)70 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)36 JobId (org.ow2.proactive.scheduler.common.job.JobId)34 InternalTaskFlowJob (org.ow2.proactive.scheduler.job.InternalTaskFlowJob)26 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)24 InternalScriptTask (org.ow2.proactive.scheduler.task.internal.InternalScriptTask)24 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)24 ArrayList (java.util.ArrayList)20 ExecuterInformation (org.ow2.proactive.scheduler.task.internal.ExecuterInformation)13 TaskResultImpl (org.ow2.proactive.scheduler.task.TaskResultImpl)12 Matchers.containsString (org.hamcrest.Matchers.containsString)10 Matchers.anyString (org.mockito.Matchers.anyString)10 ScriptExecutableContainer (org.ow2.proactive.scheduler.task.containers.ScriptExecutableContainer)9 TaskContext (org.ow2.proactive.scheduler.task.context.TaskContext)9 TaskInfoImpl (org.ow2.proactive.scheduler.task.TaskInfoImpl)8 SimpleScript (org.ow2.proactive.scripting.SimpleScript)8 TaskScript (org.ow2.proactive.scripting.TaskScript)8 NodeDataSpacesURIs (org.ow2.proactive.scheduler.task.context.NodeDataSpacesURIs)7 InProcessTaskExecutor (org.ow2.proactive.scheduler.task.executors.InProcessTaskExecutor)6