Search in sources :

Example 6 with UserException

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;
}
Also used : TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) ForkEnvironment(org.ow2.proactive.scheduler.common.task.ForkEnvironment)

Example 7 with UserException

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;
}
Also used : ScriptTask(org.ow2.proactive.scheduler.common.task.ScriptTask) TaskScript(org.ow2.proactive.scripting.TaskScript) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) SimpleScript(org.ow2.proactive.scripting.SimpleScript) ForkEnvironment(org.ow2.proactive.scheduler.common.task.ForkEnvironment)

Example 8 with UserException

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;
}
Also used : SelectionScript(org.ow2.proactive.scripting.SelectionScript) ScriptTask(org.ow2.proactive.scheduler.common.task.ScriptTask) TaskScript(org.ow2.proactive.scripting.TaskScript) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) SimpleScript(org.ow2.proactive.scripting.SimpleScript)

Example 9 with UserException

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);
}
Also used : TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) Before(org.junit.Before)

Example 10 with UserException

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;
}
Also used : TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) EmptyTask(org.ow2.proactive.scheduler.examples.EmptyTask)

Aggregations

TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)16 JavaTask (org.ow2.proactive.scheduler.common.task.JavaTask)7 Test (org.junit.Test)6 ModelValidatorContext (org.ow2.proactive.scheduler.common.job.factories.spi.model.ModelValidatorContext)6 ScriptTask (org.ow2.proactive.scheduler.common.task.ScriptTask)6 SimpleScript (org.ow2.proactive.scripting.SimpleScript)6 TaskScript (org.ow2.proactive.scripting.TaskScript)5 JobVariable (org.ow2.proactive.scheduler.common.job.JobVariable)4 ForkEnvironment (org.ow2.proactive.scheduler.common.task.ForkEnvironment)3 PatternSyntaxException (java.util.regex.PatternSyntaxException)2 UserException (org.ow2.proactive.scheduler.common.exception.UserException)2 ValidationException (org.ow2.proactive.scheduler.common.job.factories.spi.model.exceptions.ValidationException)2 Task (org.ow2.proactive.scheduler.common.task.Task)2 TaskVariable (org.ow2.proactive.scheduler.common.task.TaskVariable)2 SelectionScript (org.ow2.proactive.scripting.SelectionScript)2 PropagateVariablesExec (functionaltests.executables.PropagateVariablesExec)1 HashMap (java.util.HashMap)1 Before (org.junit.Before)1 NativeTask (org.ow2.proactive.scheduler.common.task.NativeTask)1 EmptyTask (org.ow2.proactive.scheduler.examples.EmptyTask)1