use of org.ow2.proactive.scheduler.common.task.TaskStatus in project scheduling by ow2-proactive.
the class InternalTaskParentFinderTest method generateInternalTask.
private InternalTask generateInternalTask(long id, TaskStatus taskStatus) {
InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "description");
InternalTask internalTask = new InternalScriptTask(job);
internalTask.setId(TaskIdImpl.createTaskId(new JobIdImpl(666L, "JobName"), "readableName", id));
internalTask.setStatus(taskStatus);
return internalTask;
}
use of org.ow2.proactive.scheduler.common.task.TaskStatus in project scheduling by ow2-proactive.
the class SchedulerDBManager method updateTaskData.
private int updateTaskData(final TaskState task, Session session) {
Query taskUpdateQuery = session.getNamedQuery("updateTaskData");
TaskInfo taskInfo = task.getTaskInfo();
return taskUpdateQuery.setParameter("taskStatus", taskInfo.getStatus()).setParameter("numberOfExecutionLeft", taskInfo.getNumberOfExecutionLeft()).setParameter("numberOfExecutionOnFailureLeft", taskInfo.getNumberOfExecutionOnFailureLeft()).setParameter("inErrorTime", taskInfo.getInErrorTime()).setParameter("taskId", taskId(task.getId())).executeUpdate();
}
use of org.ow2.proactive.scheduler.common.task.TaskStatus in project scheduling by ow2-proactive.
the class TaskDBUtils method getTotalNumberOfTasks.
public static SessionWork<Integer> getTotalNumberOfTasks(final DBTaskDataParameters params) {
return new SessionWork<Integer>() {
@Override
public Integer doInTransaction(Session session) {
Set<TaskStatus> taskStatuses = params.getStatuses();
if (taskStatuses.isEmpty()) {
return 0;
}
boolean hasUser = params.hasUser();
boolean hasTag = params.hasTag();
boolean hasDateFrom = params.hasDateFrom();
boolean hasDateTo = params.hasDateTo();
String queryPrefix = "select count(*) from TaskData T where ";
Query query = getQuery(session, params, taskStatuses, hasUser, hasTag, hasDateFrom, hasDateTo, SortSpecifierContainer.EMPTY_CONTAINER, queryPrefix);
Long count = (Long) query.uniqueResult();
return count.intValue();
}
};
}
use of org.ow2.proactive.scheduler.common.task.TaskStatus in project scheduling by ow2-proactive.
the class InternalJob method start.
/**
* Set all properties in order to start the job. After this method and for
* better performances you may have to set the taskStatusModify to "null" :
* setTaskStatusModify(null);
*/
public void start() {
setStartTime(System.currentTimeMillis());
setNumberOfPendingTasks(getTotalNumberOfTasks());
setNumberOfRunningTasks(0);
setStatus(JobStatus.RUNNING);
List<InternalTask> internalTasks = getITasks();
HashMap<TaskId, TaskStatus> taskStatus = new HashMap<>(internalTasks.size());
for (InternalTask internalTask : internalTasks) {
internalTask.setStatus(TaskStatus.PENDING);
taskStatus.put(internalTask.getId(), TaskStatus.PENDING);
}
}
use of org.ow2.proactive.scheduler.common.task.TaskStatus in project scheduling by ow2-proactive.
the class RunningTaskRecoveryWithDownNodeTest method checkTasks.
private void checkTasks(JobState jobState) {
int maximumNumberOfPendingTasks = jobState.getNumberOfPendingTasks();
for (int i = 0; i < maximumNumberOfPendingTasks; i++) {
TaskState taskState = jobState.getTasks().get(i);
TaskStatus taskStatus = taskState.getTaskInfo().getStatus();
assertThat(taskStatus.equals(TaskStatus.PENDING) || taskStatus.equals(TaskStatus.RUNNING)).isTrue();
}
}
Aggregations