Search in sources :

Example 1 with JobInfoData

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);
}
Also used : JobInfoData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobInfoData) JobInfo(org.ow2.proactive.scheduler.common.job.JobInfo) Test(org.junit.Test)

Example 2 with 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;
}
Also used : PermissionException(org.ow2.proactive.scheduler.common.exception.PermissionException) JobInfoData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobInfoData) NotConnectedException(org.ow2.proactive.scheduler.common.exception.NotConnectedException) UnknownJobRestException(org.ow2.proactive_grid_cloud_portal.scheduler.exception.UnknownJobRestException) PermissionRestException(org.ow2.proactive_grid_cloud_portal.scheduler.exception.PermissionRestException) UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException) NotConnectedRestException(org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException) JobInfoImpl(org.ow2.proactive.scheduler.rest.data.JobInfoImpl) JobId(org.ow2.proactive.scheduler.common.job.JobId)

Example 3 with JobInfoData

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;
}
Also used : PermissionException(org.ow2.proactive.scheduler.common.exception.PermissionException) JobInfoData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobInfoData) NotConnectedException(org.ow2.proactive.scheduler.common.exception.NotConnectedException) UnknownJobRestException(org.ow2.proactive_grid_cloud_portal.scheduler.exception.UnknownJobRestException) UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException) PermissionRestException(org.ow2.proactive_grid_cloud_portal.scheduler.exception.PermissionRestException) Scheduler(org.ow2.proactive.scheduler.common.Scheduler) NotConnectedRestException(org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException)

Example 4 with JobInfoData

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;
}
Also used : JobInfoData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobInfoData) JobIdData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobIdData) UserJobData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.UserJobData) ArrayList(java.util.ArrayList)

Aggregations

JobInfoData (org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobInfoData)4 NotConnectedException (org.ow2.proactive.scheduler.common.exception.NotConnectedException)2 PermissionException (org.ow2.proactive.scheduler.common.exception.PermissionException)2 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)2 NotConnectedRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException)2 PermissionRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.PermissionRestException)2 UnknownJobRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.UnknownJobRestException)2 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 Scheduler (org.ow2.proactive.scheduler.common.Scheduler)1 JobId (org.ow2.proactive.scheduler.common.job.JobId)1 JobInfo (org.ow2.proactive.scheduler.common.job.JobInfo)1 JobInfoImpl (org.ow2.proactive.scheduler.rest.data.JobInfoImpl)1 JobIdData (org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobIdData)1 UserJobData (org.ow2.proactive_grid_cloud_portal.scheduler.dto.UserJobData)1