use of org.ow2.proactive.scripting.TaskScript in project scheduling by ow2-proactive.
the class TestUnauthorizedScripts method createJob.
public Job createJob(String forkScriptContent, String cleanScriptContent) throws InvalidScriptException, UserException {
TaskFlowJob job = new TaskFlowJob();
job.setName(this.getClass().getSimpleName() + "_forkAndClean");
ScriptTask taskWithFork = new ScriptTask();
taskWithFork.setScript(new TaskScript(new SimpleScript("println 'Hello'", "groovy")));
ForkEnvironment forkEnvironment = new ForkEnvironment();
forkEnvironment.setEnvScript(new SimpleScript(forkScriptContent, "groovy"));
taskWithFork.setForkEnvironment(forkEnvironment);
ScriptTask taskWithClean = new ScriptTask();
taskWithClean.setScript(new TaskScript(new SimpleScript("println 'Hello'", "groovy")));
taskWithClean.setCleaningScript(new SimpleScript(cleanScriptContent, "groovy"));
job.addTask(taskWithFork);
job.addTask(taskWithClean);
return job;
}
use of org.ow2.proactive.scripting.TaskScript in project scheduling by ow2-proactive.
the class TestUnauthorizedScripts method createJobSelection.
public Job createJobSelection(String selectionScriptContent) throws InvalidScriptException, UserException {
TaskFlowJob job = new TaskFlowJob();
job.setName(this.getClass().getSimpleName() + "_selection");
ScriptTask taskWithSelection = new ScriptTask();
taskWithSelection.setScript(new TaskScript(new SimpleScript("println 'Hello'", "groovy")));
taskWithSelection.addSelectionScript(new SelectionScript(new SimpleScript(selectionScriptContent, "groovy"), true));
job.addTask(taskWithSelection);
return job;
}
use of org.ow2.proactive.scripting.TaskScript in project scheduling by ow2-proactive.
the class SchedulerEfficiencyMetricsTest method createJob.
public static TaskFlowJob createJob(int taskNumber, int taskDuration) throws Exception {
final TaskFlowJob job = new TaskFlowJob();
job.setName(String.format("EP_%d_NO_MERGE_%dSEC", taskNumber, taskDuration));
job.setOnTaskError(OnTaskError.CANCEL_JOB);
job.getVariables().put(OPTIMAL_JOB_DURATION, new JobVariable(OPTIMAL_JOB_DURATION, String.valueOf(taskDuration)));
for (int i = 0; i < taskNumber; i++) {
ScriptTask task = new ScriptTask();
task.setName("process_" + i);
task.setScript(new TaskScript(new SimpleScript(String.format("Thread.sleep(%s)", taskDuration), "groovy")));
job.addTask(task);
}
return job;
}
use of org.ow2.proactive.scripting.TaskScript in project scheduling by ow2-proactive.
the class TestJobSchedulerHome method pahomeScriptTask.
public void pahomeScriptTask() throws Throwable {
log("Test ProActive Home Script Task...");
String tname = "pahomeScriptTask";
TaskFlowJob job = new TaskFlowJob();
job.setName(this.getClass().getSimpleName() + "_" + tname);
ScriptTask task1 = new ScriptTask();
task1.setName(tname);
Script pahomeScript = new SimpleScript(TestJobSchedulerHome.class.getResource("/functionaltests/scripts/schedulerHome.js"), new String[] { schedulerHomePath });
;
TaskScript ts = new TaskScript(pahomeScript);
task1.setScript(ts);
job.addTask(task1);
submitAndCheckJob(job, tname, false);
}
use of org.ow2.proactive.scripting.TaskScript in project scheduling by ow2-proactive.
the class TestJobWalltime method walltimeScriptTask.
public JobId walltimeScriptTask() throws Throwable {
log("Test WallTime Script Task...");
String tname = "walltimeScriptTask";
// pre script interruption
TaskFlowJob job = new TaskFlowJob();
job.setName(this.getClass().getSimpleName() + "_" + tname);
ScriptTask task1 = new ScriptTask();
task1.setName(tname);
task1.setWallTime(5000);
task1.setScript(new TaskScript(new SimpleScript("while(true){java.lang.Thread.sleep(500);}", "javascript")));
job.addTask(task1);
return submitJob(job);
}
Aggregations