use of org.ow2.proactive.scripting.SelectionScript in project scheduling by ow2-proactive.
the class TestOperationsWhenUnlinked method createJobWithPendingTask.
private TaskFlowJob createJobWithPendingTask(boolean addNormalTask) throws Exception {
TaskFlowJob job = new TaskFlowJob();
job.setName(this.getClass().getSimpleName() + "_pending");
job.setOnTaskError(OnTaskError.CONTINUE_JOB_EXECUTION);
if (addNormalTask) {
JavaTask javaTask = new JavaTask();
javaTask.setExecutableClassName(EmptyTask.class.getName());
javaTask.setName(TASK_NAME);
job.addTask(javaTask);
}
JavaTask javaTask = new JavaTask();
javaTask.setExecutableClassName(EmptyTask.class.getName());
javaTask.setName("TestPendingTask");
javaTask.setSelectionScript(new SelectionScript("selected = false;", "JavaScript", false));
job.addTask(javaTask);
return job;
}
use of org.ow2.proactive.scripting.SelectionScript in project scheduling by ow2-proactive.
the class TestJobRemove method setAttributes.
private void setAttributes(Task task) throws Exception {
task.addGenericInformation("k1", "v1");
task.addGenericInformation("k2", "v2");
SimpleScript script = new SimpleScript(task.getName() + "selection script", "javascript", new String[] { "param1", "param2" });
SelectionScript ss1 = new SelectionScript(script, true);
SelectionScript ss2 = new SelectionScript(script, false);
task.addSelectionScript(ss1);
task.addSelectionScript(ss2);
task.setPreScript(new SimpleScript(task.getName() + "pre script", "javascript", new String[] { "param1", "param2" }));
task.setPostScript(new SimpleScript(task.getName() + "post script", "javascript", new String[] { "param1", "param2" }));
task.setCleaningScript(new SimpleScript(task.getName() + "clean script", "javascript", new String[] { "param1", "param2" }));
task.setFlowScript(FlowScript.createContinueFlowScript());
task.addInputFiles("f1", InputAccessMode.TransferFromGlobalSpace);
task.addInputFiles("f2", InputAccessMode.TransferFromInputSpace);
task.addInputFiles("f3", InputAccessMode.TransferFromUserSpace);
task.addOutputFiles("f1", OutputAccessMode.TransferToGlobalSpace);
task.addOutputFiles("f2", OutputAccessMode.TransferToOutputSpace);
task.addOutputFiles("f3", OutputAccessMode.TransferToUserSpace);
}
use of org.ow2.proactive.scripting.SelectionScript in project scheduling by ow2-proactive.
the class TestRestoreWorkflowJobs method createJobWithAllKindOfScripts.
private TaskFlowJob createJobWithAllKindOfScripts() throws InvalidScriptException, UserException {
TaskFlowJob jobDef = new TaskFlowJob();
JavaTask t = task("T");
ForkEnvironment forkEnvironment = new ForkEnvironment();
SimpleScript aScript = new SimpleScript("", "");
forkEnvironment.setEnvScript(aScript);
t.setPreScript(aScript);
t.setPostScript(aScript);
t.setCleaningScript(aScript);
t.setSelectionScript(new SelectionScript("", ""));
t.setFlowScript(FlowScript.createContinueFlowScript());
t.setForkEnvironment(forkEnvironment);
jobDef.addTask(t);
return jobDef;
}
use of org.ow2.proactive.scripting.SelectionScript in project scheduling by ow2-proactive.
the class TestTaskNotStarted method createJob2.
/*
* Job with two task, one task without selection script, and one task with selection script
* always returning 'false' so this task can't start
*/
private TaskFlowJob createJob2() throws Exception {
TaskFlowJob job = new TaskFlowJob();
job.setName(this.getClass().getSimpleName() + "_2");
JavaTask javaTask1 = new JavaTask();
javaTask1.setExecutableClassName(EmptyTask.class.getName());
javaTask1.setName("task1");
JavaTask javaTask2 = new JavaTask();
javaTask2.setExecutableClassName(EmptyTask.class.getName());
javaTask2.setName("task2");
SelectionScript selScript = new SelectionScript("selected = false;", "js");
javaTask2.setSelectionScript(selScript);
job.addTask(javaTask1);
job.addTask(javaTask2);
return job;
}
use of org.ow2.proactive.scripting.SelectionScript in project scheduling by ow2-proactive.
the class TestJobServerLogs method createPendingJob.
private Job createPendingJob() throws Exception {
final TaskFlowJob job = new TaskFlowJob();
JavaTask task = new JavaTask();
task.setName("jt");
task.setExecutableClassName(WaitAndPrint.class.getName());
task.addArgument("sleepTime", "1");
task.addSelectionScript(new SelectionScript("print('" + SCRIPT_OUTPUT + "'); selected = false;", "javascript"));
job.addTask(task);
return job;
}
Aggregations