use of org.ow2.proactive.scheduler.common.task.JavaTask 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.task.JavaTask 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.task.JavaTask 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;
}
use of org.ow2.proactive.scheduler.common.task.JavaTask in project scheduling by ow2-proactive.
the class TaskLauncherTest method javaTask.
@Test
public void javaTask() throws Throwable {
HashMap<String, byte[]> args = new HashMap<>();
args.put("number", AllObjects2BytesConverterHandler.convertObject2Byte("number", 123));
ScriptExecutableContainer executableContainer = new ScriptExecutableContainer(new TaskScript(new SimpleScript(WaitAndPrint.class.getName(), "java", new Serializable[] { args })));
TaskLauncherInitializer initializer = new TaskLauncherInitializer();
initializer.setTaskId(TaskIdImpl.createTaskId(JobIdImpl.makeJobId("1000"), "job*1", 1000L));
TaskResult taskResult = runTaskLauncher(createLauncherWithInjectedMocks(initializer, new TestTaskLauncherFactory()), executableContainer);
assertThat((String) taskResult.value(), is(not("")));
assertThat(taskResult.getOutput().getAllLogs(false).contains("123"), is(true));
}
use of org.ow2.proactive.scheduler.common.task.JavaTask in project scheduling by ow2-proactive.
the class SchedulingServiceTest4 method createTestJob.
private TaskFlowJob createTestJob() throws Exception {
TaskFlowJob job = new TaskFlowJob();
job.setName(this.getClass().getSimpleName());
JavaTask task1 = new JavaTask();
task1.setName("javaTask");
task1.setExecutableClassName("class");
task1.setMaxNumberOfExecution(3);
job.addTask(task1);
return job;
}
Aggregations