use of org.ow2.proactive.scheduler.common.exception.UnknownJobException in project scheduling by ow2-proactive.
the class LiveJobsTest method testFinishInErrorTask.
@Test(timeout = 60000)
public void testFinishInErrorTask() throws UnknownTaskException, UnknownJobException {
InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CONTINUE_JOB_EXECUTION, "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");
internalTask.setStatus(TaskStatus.IN_ERROR);
Node node = Mockito.mock(Node.class);
Mockito.when(node.getVMInformation()).thenAnswer(new Answer<VMInformation>() {
@Override
public VMInformation answer(InvocationOnMock invocation) throws Throwable {
return Mockito.mock(VMInformation.class);
}
});
Mockito.when(node.getNodeInformation()).thenAnswer(new Answer<NodeInformation>() {
@Override
public NodeInformation answer(InvocationOnMock invocation) throws Throwable {
return Mockito.mock(NodeInformation.class);
}
});
TaskLauncher taskLauncher = Mockito.mock(TaskLauncher.class);
internalTask.setExecuterInformation(new ExecuterInformation(taskLauncher, node));
tasksList.add(internalTask);
job.setTasks(tasksList);
liveJobs.jobSubmitted(job);
liveJobs.finishInErrorTask(job.getId(), "task-name");
assertThat(internalTask.getStatus(), is(TaskStatus.FINISHED));
}
use of org.ow2.proactive.scheduler.common.exception.UnknownJobException in project scheduling by ow2-proactive.
the class LiveJobsTest method testRestartTaskOnNodeRunningDecreasingExecution.
@Test(timeout = 60000)
public void testRestartTaskOnNodeRunningDecreasingExecution() throws UnknownJobException, UnknownTaskException {
PASchedulerProperties.NUMBER_OF_EXECUTION_ON_FAILURE.updateProperty("5");
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(5));
assertThat(internalTask.getTaskInfo().getNumberOfExecutionOnFailureLeft(), is(5));
liveJobs.restartTaskOnNodeFailure(internalTask);
internalTask.setStatus(TaskStatus.RUNNING);
assertThat(internalTask.getMaxNumberOfExecutionOnFailure(), is(5));
assertThat(internalTask.getTaskInfo().getNumberOfExecutionOnFailureLeft(), is(4));
Mockito.verify(dbManager, Mockito.times(1)).taskRestarted(job, internalTask, null);
}
use of org.ow2.proactive.scheduler.common.exception.UnknownJobException in project scheduling by ow2-proactive.
the class LiveJobsTest method testRestartTaskOnNodeFailureRunningExceptionExpectedBecauseNotLockedTask.
@Test(expected = IllegalStateException.class, timeout = 60000)
public void testRestartTaskOnNodeFailureRunningExceptionExpectedBecauseNotLockedTask() 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");
internalTask.setStatus(TaskStatus.RUNNING);
tasksList.add(internalTask);
job.setTasks(tasksList);
liveJobs.jobSubmitted(job);
liveJobs.restartTaskOnNodeFailure(internalTask);
}
use of org.ow2.proactive.scheduler.common.exception.UnknownJobException in project scheduling by ow2-proactive.
the class TestJobServerLogs method checkNoLogsFromAPI.
private void checkNoLogsFromAPI(JobId jobId, List<TaskState> tasks) throws Exception {
Scheduler scheduler = schedulerHelper.getSchedulerInterface();
try {
scheduler.getJobServerLogs(jobId.toString());
fail("getJobServerLogs should throw an exception for a removed job");
} catch (UnknownJobException expected) {
}
for (TaskState taskState : tasks) {
try {
scheduler.getTaskServerLogs(jobId.toString(), taskState.getName());
fail("getTaskServerLogs should throw an exception for a removed job");
} catch (UnknownJobException expected) {
}
}
}
use of org.ow2.proactive.scheduler.common.exception.UnknownJobException in project scheduling by ow2-proactive.
the class SchedulerFrontend method restartAllInErrorTasks.
@Override
public boolean restartAllInErrorTasks(String jobId) throws NotConnectedException, UnknownJobException, PermissionException {
final JobId jobIdObject = JobIdImpl.makeJobId(jobId);
frontendState.checkPermissions("restartAllInErrorTasks", frontendState.getIdentifiedJob(jobIdObject), YOU_DO_NOT_HAVE_PERMISSION_TO_RESTART_IN_ERROR_TASKS_IN_THIS_JOB);
return schedulingService.restartAllInErrorTasks(jobIdObject);
}
Aggregations