Search in sources :

Example 41 with InvalidScriptException

use of org.ow2.proactive.scripting.InvalidScriptException 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 42 with InvalidScriptException

use of org.ow2.proactive.scripting.InvalidScriptException in project scheduling by ow2-proactive.

the class CheckEligibleTaskDescriptorScriptTest method testOnlyCleanScriptContainsAPIBinding.

@Test
public void testOnlyCleanScriptContainsAPIBinding() throws InvalidScriptException {
    Script s = scriptWithApiBindingClient();
    Script s2 = scriptWithoutApiBinding();
    FlowScript fs = flowScriptWithoutApiBinding();
    Mockito.when(it.getPreScript()).thenReturn(s2);
    Mockito.when(it.getPostScript()).thenReturn(s2);
    Mockito.when(it.getCleaningScript()).thenReturn(s);
    Mockito.when(sec.getScript()).thenReturn(s2);
    Mockito.when(fe.getEnvScript()).thenReturn(s2);
    Mockito.when(it.getFlowScript()).thenReturn(fs);
    assertTrue(new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd));
}
Also used : SimpleScript(org.ow2.proactive.scripting.SimpleScript) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript) Script(org.ow2.proactive.scripting.Script) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript) Test(org.junit.Test)

Example 43 with InvalidScriptException

use of org.ow2.proactive.scripting.InvalidScriptException in project scheduling by ow2-proactive.

the class CheckEligibleTaskDescriptorScriptTest method testOnlyFlowScriptContainsAPIBinding.

@Test
public void testOnlyFlowScriptContainsAPIBinding() throws InvalidScriptException {
    Script s = scriptWithoutApiBinding();
    FlowScript fs = flowScriptWithApiBindingUser();
    Mockito.when(it.getPreScript()).thenReturn(s);
    Mockito.when(it.getPostScript()).thenReturn(s);
    Mockito.when(it.getCleaningScript()).thenReturn(s);
    Mockito.when(fe.getEnvScript()).thenReturn(s);
    Mockito.when(sec.getScript()).thenReturn(s);
    Mockito.when(it.getFlowScript()).thenReturn(fs);
    assertTrue(new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd));
}
Also used : SimpleScript(org.ow2.proactive.scripting.SimpleScript) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript) Script(org.ow2.proactive.scripting.Script) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript) Test(org.junit.Test)

Example 44 with InvalidScriptException

use of org.ow2.proactive.scripting.InvalidScriptException in project scheduling by ow2-proactive.

the class CheckEligibleTaskDescriptorScriptTest method testAllScriptsContainAPIBinding.

@Test
public void testAllScriptsContainAPIBinding() throws InvalidScriptException {
    Script s = scriptWithApiBindingClient();
    Script s1 = scriptWithApiBindingUser();
    Script s2 = scriptWithApiBindingGlobal();
    FlowScript fs = flowScriptWithApiBindingClient();
    Mockito.when(it.getPreScript()).thenReturn(s1);
    Mockito.when(it.getPostScript()).thenReturn(s2);
    Mockito.when(it.getCleaningScript()).thenReturn(s2);
    Mockito.when(sec.getScript()).thenReturn(s);
    Mockito.when(fe.getEnvScript()).thenReturn(s);
    Mockito.when(it.getFlowScript()).thenReturn(fs);
    assertTrue(new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd));
}
Also used : SimpleScript(org.ow2.proactive.scripting.SimpleScript) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript) Script(org.ow2.proactive.scripting.Script) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript) Test(org.junit.Test)

Example 45 with InvalidScriptException

use of org.ow2.proactive.scripting.InvalidScriptException in project scheduling by ow2-proactive.

the class CheckEligibleTaskDescriptorScriptTest method testAllScriptsNotContainAPIBinding.

@Test
public void testAllScriptsNotContainAPIBinding() throws InvalidScriptException {
    Script s = scriptWithoutApiBinding();
    FlowScript fs = flowScriptWithoutApiBinding();
    Mockito.when(it.getPreScript()).thenReturn(s);
    Mockito.when(it.getPostScript()).thenReturn(s);
    Mockito.when(it.getCleaningScript()).thenReturn(s);
    Mockito.when(sec.getScript()).thenReturn(s);
    Mockito.when(fe.getEnvScript()).thenReturn(s);
    Mockito.when(it.getFlowScript()).thenReturn(fs);
    assertFalse(new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd));
}
Also used : SimpleScript(org.ow2.proactive.scripting.SimpleScript) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript) Script(org.ow2.proactive.scripting.Script) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)27 SimpleScript (org.ow2.proactive.scripting.SimpleScript)27 VariablesMap (org.ow2.proactive.scheduler.task.utils.VariablesMap)15 ScriptHandler (org.ow2.proactive.scripting.ScriptHandler)15 ForkEnvironment (org.ow2.proactive.scheduler.common.task.ForkEnvironment)14 ScriptExecutableContainer (org.ow2.proactive.scheduler.task.containers.ScriptExecutableContainer)14 TaskContext (org.ow2.proactive.scheduler.task.context.TaskContext)14 TaskLauncherInitializer (org.ow2.proactive.scheduler.task.TaskLauncherInitializer)12 NodeDataSpacesURIs (org.ow2.proactive.scheduler.task.context.NodeDataSpacesURIs)12 TaskScript (org.ow2.proactive.scripting.TaskScript)12 FlowScript (org.ow2.proactive.scheduler.common.task.flow.FlowScript)11 Script (org.ow2.proactive.scripting.Script)11 HashMap (java.util.HashMap)6 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)6 InternalScriptTask (org.ow2.proactive.scheduler.task.internal.InternalScriptTask)6 InvalidScriptException (org.ow2.proactive.scripting.InvalidScriptException)6 ScriptTask (org.ow2.proactive.scheduler.common.task.ScriptTask)5 File (java.io.File)4 SelectionScript (org.ow2.proactive.scripting.SelectionScript)4 Serializable (java.io.Serializable)3