use of org.ow2.proactive.scheduler.job.InternalJob 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.job.InternalJob 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();
}
use of org.ow2.proactive.scheduler.job.InternalJob in project scheduling by ow2-proactive.
the class SchedulerDbManagerRecoveryTest method testJobRecovery.
private InternalJob testJobRecovery(String workflowFilename) throws Exception {
Job job = Jobs.parseXml(this.getClass().getResource("/functionaltests/workflow/descriptors/" + workflowFilename).getPath());
InternalJob submittedJob = Jobs.createJob(job);
dbManager.newJobSubmitted(submittedJob);
closeAndRestartDatabase();
List<InternalJob> internalJobs = dbManager.loadJobs(true, submittedJob.getId());
assertThat(internalJobs).hasSize(1);
InternalJob loadedJob = internalJobs.get(0);
loadedJob.equals(submittedJob);
assertThat(Jobs.areEqual(submittedJob, loadedJob)).isTrue();
return loadedJob;
}
use of org.ow2.proactive.scheduler.job.InternalJob in project scheduling by ow2-proactive.
the class SchedulingServiceTest2 method testNotStartedJob.
@Test
public void testNotStartedJob() throws Exception {
InternalJob job = createJob(createTestJob());
service.submitJob(job);
listener.assertEvents(SchedulerEvent.JOB_SUBMITTED);
service.killJob(job.getId());
listener.assertEvents(SchedulerEvent.TASK_RUNNING_TO_FINISHED, SchedulerEvent.TASK_RUNNING_TO_FINISHED, SchedulerEvent.JOB_PENDING_TO_FINISHED, SchedulerEvent.JOB_UPDATED);
}
use of org.ow2.proactive.scheduler.job.InternalJob in project scheduling by ow2-proactive.
the class OnErrorPolicyInterpreterTest method createTask.
private InternalTask createTask() {
InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "description");
InternalTask task = new InternalTask(job) {
@Override
public boolean handleResultsArguments() {
// TODO Auto-generated method stub
return false;
}
@Override
public TaskLauncher createLauncher(Node node) throws ActiveObjectCreationException, NodeException {
// TODO Auto-generated method stub
return null;
}
};
return task;
}
Aggregations