Search in sources :

Example 41 with SelectionScript

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

Example 42 with SelectionScript

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);
}
Also used : SelectionScript(org.ow2.proactive.scripting.SelectionScript) SimpleScript(org.ow2.proactive.scripting.SimpleScript)

Example 43 with SelectionScript

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;
}
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)

Example 44 with SelectionScript

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

Example 45 with SelectionScript

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

Aggregations

SelectionScript (org.ow2.proactive.scripting.SelectionScript)42 Test (org.junit.Test)18 File (java.io.File)13 RMFunctionalTest (functionaltests.utils.RMFunctionalTest)10 NodeSet (org.ow2.proactive.utils.NodeSet)10 ResourceManager (org.ow2.proactive.resourcemanager.frontend.ResourceManager)9 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)9 JavaTask (org.ow2.proactive.scheduler.common.task.JavaTask)9 RMNode (org.ow2.proactive.resourcemanager.rmnode.RMNode)8 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)7 RMNodeEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeEvent)6 SelectionManager (org.ow2.proactive.resourcemanager.selection.SelectionManager)6 SelectionManagerTest (org.ow2.proactive.resourcemanager.selection.SelectionManagerTest)6 SimpleScript (org.ow2.proactive.scripting.SimpleScript)6 TestNode (functionaltests.utils.TestNode)5 Criteria (org.ow2.proactive.utils.Criteria)4 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)3 HashSet (java.util.HashSet)3 Node (org.objectweb.proactive.core.node.Node)3