use of org.ow2.proactive.scheduler.common.task.JavaTask in project scheduling by ow2-proactive.
the class TaskDBUtilsTest method insertNewJob.
public InternalJob insertNewJob(String user) throws Exception {
TaskFlowJob jobDef = new TaskFlowJob();
JavaTask javaTask = createDefaultTask("java task");
javaTask.setExecutableClassName(TestDummyExecutable.class.getName());
jobDef.addTask(javaTask);
return defaultSubmitJob(jobDef, user);
}
use of org.ow2.proactive.scheduler.common.task.JavaTask in project scheduling by ow2-proactive.
the class TestJobRemove method testMultipleDataRemoved.
@Test
public void testMultipleDataRemoved() throws Exception {
TaskFlowJob jobDef = new TaskFlowJob();
JavaTask task1 = new JavaTask();
task1.setName("task1");
task1.setExecutableClassName(TestDummyExecutable.class.getName());
jobDef.addTask(task1);
List<InternalJob> jobs = IntStream.range(0, 5).boxed().map(x -> {
try {
return defaultSubmitJob(jobDef);
} catch (Exception e) {
return null;
}
}).collect(Collectors.toList());
System.out.println("Remove jobs");
long start = System.currentTimeMillis();
dbManager.removeJob(jobs.stream().map(JobState::getId).collect(Collectors.toList()), 0, true);
System.out.println("Remove time (5 jobs)" + (System.currentTimeMillis() - start));
checkAllEntitiesDeleted();
}
use of org.ow2.proactive.scheduler.common.task.JavaTask in project scheduling by ow2-proactive.
the class TestLoadJobsPagination method createJob.
private TaskFlowJob createJob(String name, JobPriority priority, String projectName, Long parentId) throws Exception {
TaskFlowJob job = new TaskFlowJob();
if (name != null) {
job.setName(name);
} else {
job.setName(this.getClass().getSimpleName());
}
if (projectName != null) {
job.setProjectName(projectName);
} else {
job.setProjectName(this.getClass().getSimpleName() + " project");
}
if (priority != null) {
job.setPriority(priority);
} else {
job.setPriority(JobPriority.NORMAL);
}
job.setParentId(parentId);
job.setDescription("TestLoadJobsPagination desc");
JavaTask task = new JavaTask();
task.setExecutableClassName("className");
job.addTask(task);
return job;
}
use of org.ow2.proactive.scheduler.common.task.JavaTask in project scheduling by ow2-proactive.
the class TestMultipleTasks method testDependencies.
@Test
public void testDependencies() throws Exception {
TaskFlowJob job = new TaskFlowJob();
JavaTask task1 = createDefaultTask("task1");
job.addTask(task1);
JavaTask task2 = createDefaultTask("task2");
job.addTask(task2);
task1.addDependence(task2);
JavaTask task3 = createDefaultTask("task3");
job.addTask(task3);
task2.addDependence(task3);
InternalJob jobData = defaultSubmitJobAndLoadInternal(true, job);
Assert.assertEquals(3, jobData.getITasks().size());
InternalTask taskData1 = jobData.getTask("task1");
InternalTask taskData2 = jobData.getTask("task2");
InternalTask taskData3 = jobData.getTask("task3");
Assert.assertEquals(1, taskData1.getDependences().size());
Assert.assertEquals(1, taskData2.getDependences().size());
Assert.assertNull(taskData3.getDependences());
Assert.assertEquals(taskData2.getId(), taskData1.getDependences().get(0).getId());
Assert.assertEquals(taskData3.getId(), taskData2.getDependences().get(0).getId());
Assert.assertEquals(taskData2.getTaskInfo().getTaskId(), taskData1.getDependences().get(0).getTaskInfo().getTaskId());
Assert.assertEquals(taskData3.getTaskInfo().getTaskId(), taskData2.getDependences().get(0).getTaskInfo().getTaskId());
}
use of org.ow2.proactive.scheduler.common.task.JavaTask in project scheduling by ow2-proactive.
the class TestTaskRuntimeData method testTaskRuntimeData.
@Test
public void testTaskRuntimeData() throws Exception {
TaskFlowJob job = new TaskFlowJob();
JavaTask task1 = createDefaultTask("task1");
task1.setMaxNumberOfExecution(5);
job.addTask(task1);
InternalJob jobData = defaultSubmitJobAndLoadInternal(true, job);
Assert.assertEquals(1, jobData.getITasks().size());
InternalTask runtimeData = jobData.getITasks().get(0);
Assert.assertEquals("task1", runtimeData.getName());
Assert.assertEquals(TaskStatus.SUBMITTED, runtimeData.getStatus());
Assert.assertEquals(5, runtimeData.getNumberOfExecutionLeft());
Assert.assertEquals(PASchedulerProperties.NUMBER_OF_EXECUTION_ON_FAILURE.getValueAsInt(), runtimeData.getNumberOfExecutionOnFailureLeft());
Assert.assertNull(runtimeData.getDependences());
}
Aggregations