Search in sources :

Example 76 with JobIdImpl

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

the class JobEmailNotificationTest method testResumed.

@Test
public void testResumed() throws Exception {
    InternalJob job = createJob(USER_EMAIL);
    job.setId(new JobIdImpl(123890, job.getName()));
    job.setStatus(JobStatus.PENDING);
    Map<String, String> genericInfo = job.getGenericInformation();
    genericInfo.put("NOTIFICATION_EVENTS", "Job resumed");
    job.setGenericInformation(genericInfo);
    boolean sent = sendNotification(job, SchedulerEvent.JOB_RESUMED, stubbedSender);
    assertTrue(sent);
    verify(stubbedSender).sender(eq(USER_EMAIL), contains("ProActive Job 123890 : Job resumed"), contains("Status: Pending"));
    verifyNoMoreInteractions(stubbedSender);
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) Matchers.anyString(org.mockito.Matchers.anyString) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 77 with JobIdImpl

use of org.ow2.proactive.scheduler.job.JobIdImpl 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();
    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)

Example 78 with JobIdImpl

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

the class LiveJobsTest method testGetRunningTaskByTaskId.

@Test(timeout = 600000)
public void testGetRunningTaskByTaskId() throws UnknownTaskException {
    PASchedulerProperties.NUMBER_OF_EXECUTION_ON_FAILURE.updateProperty("5");
    JobId id = new JobIdImpl(666L, "test-name");
    TaskId tid = TaskIdImpl.createTaskId(id, "task-name", 0L);
    submitJobAndStartTask(id, tid);
    JobId id2 = new JobIdImpl(667L, "test-name");
    TaskId tid2 = TaskIdImpl.createTaskId(id2, "task-name2", 0L);
    submitJobAndStartTask(id2, tid2);
    JobId id3 = new JobIdImpl(668L, "test-name");
    TaskId tid3 = TaskIdImpl.createTaskId(id3, "task-name3", 0L);
    submitJobAndStartTask(id3, tid3);
    JobId id4 = new JobIdImpl(669L, "test-name");
    TaskId tid4 = TaskIdImpl.createTaskId(id4, "task-name4", 0L);
    submitJobAndStartTask(id4, tid4);
    JobId id5 = new JobIdImpl(670L, "test-name");
    TaskId tid5 = TaskIdImpl.createTaskId(id5, "task-name5", 0L);
    submitJobAndStartTask(id5, tid5);
    assertThat(liveJobs.getRunningTasks().size(), is(5));
    assertThat(liveJobs.getRunningTask(tid).getTask().getName(), is("task-name"));
    assertThat(liveJobs.getRunningTask(tid).getTask().getJobId(), is(id));
}
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 79 with JobIdImpl

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

the class LiveJobsTest method testLockJobsToSchedule.

@Test(timeout = 60000)
public void testLockJobsToSchedule() 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");
    tasksList.add(internalTask);
    job.setTasks(tasksList);
    liveJobs.jobSubmitted(job);
    liveJobs.pauseJob(id);
    assertThat(liveJobs.lockJobsToSchedule().size(), is(1));
}
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 80 with JobIdImpl

use of org.ow2.proactive.scheduler.job.JobIdImpl 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)

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