use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestInMemorySchedulerDB method sanityTestJobContent.
@Test
public void sanityTestJobContent() throws Exception {
SchedulerDBManager dbManager = SchedulerDBManager.createInMemorySchedulerDBManager();
TaskFlowJob jobDef = new TaskFlowJob();
jobDef.addTask(BaseSchedulerDBTest.createDefaultTask("task1"));
jobDef.addTask(BaseSchedulerDBTest.createDefaultTask("task2"));
jobDef.addTask(BaseSchedulerDBTest.createDefaultTask("task3"));
InternalJob job = InternalJobFactory.createJob(jobDef, BaseSchedulerDBTest.getDefaultCredentials());
job.setOwner("test");
dbManager.newJobSubmitted(job);
Job content = dbManager.loadInitalJobContent(job.getId());
Assert.assertTrue(content instanceof TaskFlowJob);
Assert.assertThat(((TaskFlowJob) content).getTasks().size(), is(3));
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestLoadJobsPagination method createJob.
private TaskFlowJob createJob() throws Exception {
TaskFlowJob job = new TaskFlowJob();
job.setName(this.getClass().getSimpleName());
job.setDescription("TestLoadJobsPagination desc");
JavaTask task = new JavaTask();
task.setExecutableClassName("className");
job.addTask(task);
return job;
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestProcessTreeKiller method createJavaExecutableJob.
public static TaskFlowJob createJavaExecutableJob(String name, boolean forked) throws UserException {
TaskFlowJob job = new TaskFlowJob();
job.setName(name);
job.setDescription("A command that spawns processes");
JavaTask task = new JavaTask();
if (forked) {
task.setForkEnvironment(new ForkEnvironment());
}
task.addArgument("sleep", 3);
task.addArgument("tname", name);
task.addArgument("home", PASchedulerProperties.SCHEDULER_HOME.getValueAsString());
task.setName(name);
task.setExecutableClassName(JavaSpawnExecutable.class.getName());
job.addTask(task);
return job;
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class ValidationUtil method fillUpdatedVariables.
private void fillUpdatedVariables(TaskFlowJob job, JobValidationData data) {
HashMap<String, String> updatedVariables = new HashMap<>();
for (JobVariable jobVariable : job.getVariables().values()) {
updatedVariables.put(jobVariable.getName(), jobVariable.getValue());
}
for (Task task : job.getTasks()) {
for (TaskVariable taskVariable : task.getVariables().values()) {
updatedVariables.put(task.getName() + ":" + taskVariable.getName(), taskVariable.getValue());
}
}
data.setUpdatedVariables(updatedVariables);
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class AbstractRestFuncTestCase method createJob.
protected Job createJob(Class<?> clazz) throws Exception {
TaskFlowJob job = new TaskFlowJob();
job.setName(clazz.getSimpleName());
job.setPriority(JobPriority.NORMAL);
job.setOnTaskError(OnTaskError.CANCEL_JOB);
job.setDescription("Test " + clazz.getSimpleName());
job.setMaxNumberOfExecution(1);
JavaTask task = new JavaTask();
task.setName(getTaskNameForClass(clazz));
task.setExecutableClassName(clazz.getName());
task.setMaxNumberOfExecution(1);
task.setOnTaskError(OnTaskError.CANCEL_JOB);
String classpath = RestFuncTUtils.getClassPath(clazz);
ForkEnvironment forkEnvironment = new ForkEnvironment();
forkEnvironment.addAdditionalClasspath(classpath);
task.setForkEnvironment(forkEnvironment);
job.addTask(task);
return job;
}
Aggregations