Search in sources :

Example 1 with TaskStateImpl

use of org.ow2.proactive.scheduler.rest.data.TaskStateImpl in project scheduling by ow2-proactive.

the class SchedulerClient method getTaskStates.

@Override
public Page<TaskState> getTaskStates(String taskTag, long from, long to, boolean mytasks, boolean running, boolean pending, boolean finished, int offset, int limit, SortSpecifierContainer sortParams) throws NotConnectedException, PermissionException {
    RestPage<TaskStateData> page = null;
    SortSpecifierContainer sortContainer = new SortSpecifierContainer(sortParams.toString());
    try {
        page = restApi().getTaskStates(sid, from, to, mytasks, running, pending, finished, offset, limit, sortContainer);
    } catch (NotConnectedRestException e) {
        throw new NotConnectedException(e);
    } catch (PermissionRestException e) {
        throw new PermissionException(e);
    }
    List<TaskState> lTaskStates = new ArrayList<TaskState>(page.getList().size());
    for (TaskStateData taskStateData : page.getList()) {
        lTaskStates.add(new TaskStateImpl(taskStateData));
    }
    return new Page<TaskState>(lTaskStates, page.getSize());
}
Also used : PermissionException(org.ow2.proactive.scheduler.common.exception.PermissionException) SortSpecifierContainer(org.ow2.proactive.scheduler.common.SortSpecifierContainer) TaskStateData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskStateData) NotConnectedException(org.ow2.proactive.scheduler.common.exception.NotConnectedException) PermissionRestException(org.ow2.proactive_grid_cloud_portal.scheduler.exception.PermissionRestException) ArrayList(java.util.ArrayList) TaskStateImpl(org.ow2.proactive.scheduler.rest.data.TaskStateImpl) NotConnectedRestException(org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException) Page(org.ow2.proactive.scheduler.common.Page) RestPage(org.ow2.proactive_grid_cloud_portal.scheduler.dto.RestPage) TaskState(org.ow2.proactive.scheduler.common.task.TaskState)

Example 2 with TaskStateImpl

use of org.ow2.proactive.scheduler.rest.data.TaskStateImpl in project scheduling by ow2-proactive.

the class TaskData method toTaskState.

public TaskState toTaskState() {
    TaskInfo taskInfo = toTaskInfo();
    TaskStateImpl taskState = new TaskStateImpl();
    taskState.update(taskInfo);
    taskState.setName(getTaskName());
    taskState.setDescription(getDescription());
    taskState.setTag(getTag());
    taskState.setIterationIndex(getIteration());
    taskState.setReplicationIndex(getReplication());
    taskState.setMaxNumberOfExecution(getMaxNumberOfExecution());
    taskState.setParallelEnvironment(getParallelEnvironment());
    taskState.setGenericInformation(getGenericInformation());
    taskState.setVariables(variablesToTaskVariables());
    return taskState;
}
Also used : TaskInfo(org.ow2.proactive.scheduler.common.task.TaskInfo) TaskStateImpl(org.ow2.proactive.scheduler.task.TaskStateImpl)

Aggregations

ArrayList (java.util.ArrayList)1 Page (org.ow2.proactive.scheduler.common.Page)1 SortSpecifierContainer (org.ow2.proactive.scheduler.common.SortSpecifierContainer)1 NotConnectedException (org.ow2.proactive.scheduler.common.exception.NotConnectedException)1 PermissionException (org.ow2.proactive.scheduler.common.exception.PermissionException)1 TaskInfo (org.ow2.proactive.scheduler.common.task.TaskInfo)1 TaskState (org.ow2.proactive.scheduler.common.task.TaskState)1 TaskStateImpl (org.ow2.proactive.scheduler.rest.data.TaskStateImpl)1 TaskStateImpl (org.ow2.proactive.scheduler.task.TaskStateImpl)1 RestPage (org.ow2.proactive_grid_cloud_portal.scheduler.dto.RestPage)1 TaskStateData (org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskStateData)1 NotConnectedRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException)1 PermissionRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.PermissionRestException)1