Search in sources :

Example 21 with UserException

use of org.ow2.proactive.scheduler.common.exception.UserException in project scheduling by ow2-proactive.

the class RestSmartProxyTest method createInErrorJob.

private TaskFlowJob createInErrorJob() throws InvalidScriptException, UserException {
    TaskFlowJob job = new TaskFlowJob();
    job.setName("JobWithInErrorTask");
    ScriptTask scriptTask = new ScriptTask();
    scriptTask.setName(inerrorTaskName);
    scriptTask.setScript(new TaskScript(new SimpleScript("syntax error", "python")));
    scriptTask.setOnTaskError(OnTaskError.PAUSE_TASK);
    scriptTask.setMaxNumberOfExecution(2);
    job.addTask(scriptTask);
    job.setInputSpace(userspace);
    job.setOutputSpace(userspace);
    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)

Example 22 with UserException

use of org.ow2.proactive.scheduler.common.exception.UserException in project scheduling by ow2-proactive.

the class TestDataspaceConcurrentKilling method createJobWithFileTransfers.

public Job createJobWithFileTransfers() throws UserException, InvalidScriptException {
    TaskFlowJob job = new TaskFlowJob();
    job.setName(JOB_NAME);
    job.setOnTaskError(OnTaskError.CONTINUE_JOB_EXECUTION);
    for (int i = 0; i < NB_TASKS; i++) {
        ScriptTask st = new ScriptTask();
        st.setName(TASK_NAME + i);
        st.setScript(new TaskScript(new SimpleScript("new File(localspace, \"" + FILE_NAME + i + "\").createNewFile(); java.lang.Thread.sleep(1000)", "groovy")));
        st.addOutputFiles(FILE_NAME + i, OutputAccessMode.TransferToUserSpace);
        job.addTask(st);
    }
    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)

Example 23 with UserException

use of org.ow2.proactive.scheduler.common.exception.UserException 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;
}
Also used : SelectionScript(org.ow2.proactive.scripting.SelectionScript) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) SimpleScript(org.ow2.proactive.scripting.SimpleScript) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) ForkEnvironment(org.ow2.proactive.scheduler.common.task.ForkEnvironment)

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