use of org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobInfoData in project scheduling by ow2-proactive.
the class SchedulerStateRestJobTest method testJobInfo.
@Test
public void testJobInfo() throws Throwable {
String JobId = "3";
JobInfo jobInfo = RestTestUtils.newMockedJobInfo(JobId, null, 50);
when(mockOfScheduler.getJobInfo("3")).thenReturn(jobInfo);
JobInfoData jobInfoData = restInterface.jobInfo(sessionId, JobId);
RestTestUtils.assertJobInfo(jobInfo, jobInfoData);
}
use of org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobInfoData 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;
}
use of org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobInfoData in project scheduling by ow2-proactive.
the class SchedulerStateRest method jobInfo.
/**
* {@inheritDoc}
*/
@Override
public JobInfoData jobInfo(String sessionId, String jobId) throws NotConnectedRestException, PermissionRestException, UnknownJobRestException {
Scheduler s = checkAccess(sessionId, "jobs/" + jobId + "/info");
JobInfoData job = null;
try {
job = mapper.map(s.getJobInfo(jobId), JobInfoData.class);
} catch (NotConnectedException e) {
throw new NotConnectedRestException(e);
} catch (UnknownJobException e) {
throw new UnknownJobRestException(e);
} catch (PermissionException e) {
throw new PermissionRestException(e);
}
return job;
}
use of org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobInfoData in project scheduling by ow2-proactive.
the class ListJobCommandTest method createUserJobInfoList.
private List<UserJobData> createUserJobInfoList(int jobsNumber) {
List<UserJobData> userJobInfoList = new ArrayList<UserJobData>(1);
for (int i = 0; i < jobsNumber; i++) {
JobInfoData jobInfoData = new JobInfoData();
JobIdData jobIdData = new JobIdData();
jobIdData.setId(i);
jobIdData.setReadableName(i + "name");
jobInfoData.setJobId(jobIdData);
jobInfoData.setPriority(JobPriorityData.HIGH);
jobInfoData.setStatus(JobStatusData.FINISHED);
jobInfoData.setStartTime(System.currentTimeMillis() - 1000);
jobInfoData.setFinishedTime(System.currentTimeMillis());
jobInfoData.setJobOwner("test");
userJobInfoList.add(new UserJobData(jobInfoData));
}
return userJobInfoList;
}
Aggregations