use of org.ow2.proactive.scheduler.common.exception.UserException 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.exception.UserException 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.scheduler.common.exception.UserException 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.scheduler.common.exception.UserException in project scheduling by ow2-proactive.
the class ByteCompressionUtilsTest method setup.
@Before
public void setup() throws UserException {
job = new TaskFlowJob();
job.setName(this.getClass().getName());
job.addTask(new JavaTask());
jobByte = SerializationUtils.serialize(job);
}
use of org.ow2.proactive.scheduler.common.exception.UserException in project scheduling by ow2-proactive.
the class ParallelTaskSchedulingTest method createJob.
private TaskFlowJob createJob(int numberOfTasks) throws UserException {
TaskFlowJob job = new TaskFlowJob();
for (int i = 0; i < numberOfTasks; i++) {
JavaTask task = new JavaTask();
task.setName("JavaTask_" + i);
task.setExecutableClassName(EmptyTask.class.getName());
job.addTask(task);
}
return job;
}
Aggregations