use of org.ow2.proactive.scheduler.common.exception.UnknownJobException in project scheduling by ow2-proactive.
the class RestSchedulerJobTaskTest method cleanScheduler.
private static void cleanScheduler() throws NotConnectedException, PermissionException, UnknownJobException {
Scheduler scheduler = RestFuncTHelper.getScheduler();
SchedulerState state = scheduler.getState();
Iterable<JobState> jobs = Iterables.concat(state.getPendingJobs(), state.getRunningJobs(), state.getFinishedJobs());
for (JobState jobState : jobs) {
JobId jobId = jobState.getId();
scheduler.killJob(jobId);
scheduler.removeJob(jobId);
}
}
use of org.ow2.proactive.scheduler.common.exception.UnknownJobException in project scheduling by ow2-proactive.
the class SchedulerStateRestLiveLogsTest method verifyListenAndGetAppender.
private Appender verifyListenAndGetAppender(String jobId) throws NotConnectedException, UnknownJobException, PermissionException, LogForwardingException {
ArgumentCaptor<AppenderProvider> appenderProviderArgumentCaptor = ArgumentCaptor.forClass(AppenderProvider.class);
verify(scheduler).listenJobLogs(eq(jobId), appenderProviderArgumentCaptor.capture());
AppenderProvider appenderProvider = appenderProviderArgumentCaptor.getValue();
return appenderProvider.getAppender();
}
use of org.ow2.proactive.scheduler.common.exception.UnknownJobException in project scheduling by ow2-proactive.
the class NoVncSecuredTargetResolverTest method mockSchedulerState.
@Before
public void mockSchedulerState() throws NotConnectedException, UnknownJobException, PermissionException {
JobState jobState = mock(JobState.class);
when(schedulerMock.getJobState("42")).thenReturn(jobState);
TaskState taskState = mock(TaskState.class);
when(taskState.getName()).thenReturn("remoteVisuTask");
TaskId taskId = mock(TaskId.class);
when(taskId.value()).thenReturn("1");
when(taskState.getId()).thenReturn(taskId);
when(jobState.getHMTasks()).thenReturn(Collections.singletonMap(taskId, taskState));
}
use of org.ow2.proactive.scheduler.common.exception.UnknownJobException in project scheduling by ow2-proactive.
the class AbstractFunctCmdTest method cleanScheduler.
protected void cleanScheduler() throws NotConnectedException, PermissionException, UnknownJobException {
scheduler = RestFuncTHelper.getScheduler();
SchedulerState state = scheduler.getState();
System.out.println("Cleaning scheduler.");
List<JobState> aliveJobsStates = new ArrayList<>(state.getPendingJobs().size() + state.getRunningJobs().size());
aliveJobsStates.addAll(state.getPendingJobs());
aliveJobsStates.addAll(state.getRunningJobs());
List<JobState> finishedJobsStates = new ArrayList<>(state.getFinishedJobs().size());
finishedJobsStates.addAll(state.getFinishedJobs());
for (JobState jobState : aliveJobsStates) {
JobId jobId = jobState.getId();
try {
System.out.println("Killing job " + jobId);
scheduler.killJob(jobId);
} catch (Exception ignored) {
}
System.out.println("Removing killed job " + jobId);
scheduler.removeJob(jobId);
}
for (JobState jobState : finishedJobsStates) {
JobId jobId = jobState.getId();
System.out.println("Removing finished job " + jobId);
scheduler.removeJob(jobId);
}
}
use of org.ow2.proactive.scheduler.common.exception.UnknownJobException in project scheduling by ow2-proactive.
the class SchedulerClient method getJobInfo.
@Override
public JobInfo getJobInfo(String jobId) throws UnknownJobException, NotConnectedException, PermissionException {
JobInfoData jobInfoData = null;
try {
jobInfoData = restApi().jobInfo(sid, jobId);
} catch (NotConnectedRestException e) {
throw new NotConnectedException(e);
} catch (PermissionRestException e) {
throw new PermissionException(e);
} catch (UnknownJobRestException e) {
throw new UnknownJobException(e);
}
JobInfoImpl jobInfoImpl = new JobInfoImpl();
JobId newJobId = JobIdImpl.makeJobId(jobId);
jobInfoImpl.setJobId(newJobId);
jobInfoImpl.setJobOwner(jobInfoData.getJobOwner());
jobInfoImpl.setFinishedTime(jobInfoData.getFinishedTime());
jobInfoImpl.setRemovedTime(jobInfoData.getRemovedTime());
jobInfoImpl.setStartTime(jobInfoData.getStartTime());
jobInfoImpl.setInErrorTime(jobInfoData.getInErrorTime());
jobInfoImpl.setSubmittedTime(jobInfoData.getSubmittedTime());
jobInfoImpl.setNumberOfFinishedTasks(jobInfoData.getNumberOfFinishedTasks());
jobInfoImpl.setNumberOfPendingTasks(jobInfoData.getNumberOfPendingTasks());
jobInfoImpl.setNumberOfRunningTasks(jobInfoData.getNumberOfRunningTasks());
jobInfoImpl.setNumberOfInErrorTasks(jobInfoData.getNumberOfInErrorTasks());
jobInfoImpl.setNumberOfFaultyTasks(jobInfoData.getNumberOfFaultyTasks());
jobInfoImpl.setTotalNumberOfTasks(jobInfoData.getTotalNumberOfTasks());
jobInfoImpl.setJobPriority(JobPriority.findPriority(jobInfoData.getPriority().toString()));
jobInfoImpl.setJobStatus(JobStatus.findPriority(jobInfoData.getStatus().toString()));
if (jobInfoData.isToBeRemoved())
jobInfoImpl.setToBeRemoved();
jobInfoImpl.setGenericInformation(jobInfoData.getGenericInformation());
jobInfoImpl.setVariables(jobInfoData.getVariables());
return jobInfoImpl;
}
Aggregations