use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.
the class TestUsageData method finishTask.
private void finishTask(InternalJob job, InternalTask task) throws Exception {
Thread.sleep(10);
TaskResultImpl res = new TaskResultImpl(null, "ok", null, 42);
job.terminateTask(false, task.getId(), null, null, res);
if (job.isFinished()) {
job.terminate();
}
dbManager.updateAfterTaskFinished(job, task, res);
}
use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.
the class SchedulerDBManagerTest method startJob.
private void startJob(int jobIndex) throws Throwable {
InternalJob startedJob = actualInternalJobs.get(jobIndex);
startedJob.start();
for (InternalTask task : startedJob.getITasks()) {
task.setStatus(TaskStatus.RUNNING);
}
dbManager.updateJobAndTasksState(startedJob);
}
use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.
the class SchedulerDBManagerTest method testUpdateTaskState.
@Test
public void testUpdateTaskState() throws Exception {
InternalJob job = createTestJob("test", "tag", 1);
service.submitJob(job);
InternalTask internalTask = job.getITasks().get(0);
internalTask.setStatus(TaskStatus.ABORTED);
dbManager.updateTaskState(internalTask);
Page<TaskState> tasks = dbManager.getTaskStates(0, 10, null, 0, 10, null, true, true, true, new SortSpecifierContainer());
assertThat(tasks.getSize()).isEqualTo(1);
TaskState taskState = tasks.getList().get(0);
assertThat(taskState.getStatus()).isEqualTo(TaskStatus.ABORTED);
}
use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.
the class SchedulerDBManagerTest method terminateJob.
private void terminateJob(int jobIndex, long finishedTime) throws Throwable {
InternalJob finishedJob = actualInternalJobs.get(jobIndex);
finishedJob.start();
finishedJob.terminate();
for (InternalTask task : finishedJob.getITasks()) {
TaskResultImpl result = new TaskResultImpl(task.getId(), "ok", null, 0);
FlowAction action = new FlowAction(FlowActionType.CONTINUE);
ChangedTasksInfo changesInfo = finishedJob.terminateTask(false, task.getId(), null, action, result);
task.setFinishedTime(finishedTime);
dbManager.updateAfterWorkflowTaskFinished(finishedJob, changesInfo, result);
}
}
use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.
the class SchedulerDbManagerRecoveryTest method testJobRecoveryWithIfInALoop.
/**
* Regression test related to issue #1988:
* <p>
* https://github.com/ow2-proactive/scheduling/issues/1988
*/
@Test
public void testJobRecoveryWithIfInALoop() throws Exception {
InternalJob reloadedJob = testJobRecovery("flow_if_in_a_loop.xml");
// joined branches should be saved and restored
InternalTask task = reloadedJob.getTask("Loop");
assertThat(task).isNotNull();
assertThat(task.getJoinedBranches()).isNotEmpty();
}
Aggregations