use of org.ow2.proactive.scripting.InvalidScriptException in project scheduling by ow2-proactive.
the class SelectionScriptEvaluator method evaluateScript.
private static void evaluateScript(String selectionScript) {
try {
final ScriptHandler localHandler = ScriptLoader.createLocalHandler();
final ScriptResult<Boolean> result = localHandler.handle(new SelectionScript(new File(selectionScript), null));
if (result.errorOccured()) {
result.getException().printStackTrace(System.err);
System.exit(3);
}
} catch (InvalidScriptException e) {
System.exit(2);
}
}
use of org.ow2.proactive.scripting.InvalidScriptException in project scheduling by ow2-proactive.
the class FlatJobFactory method createNativeTaskFromCommandString.
/**
* Creates a native task from a string representing a native command to execute.
* @param command a String representing a native command.
* @param taskName an eventual name for the task.
* @param selectionScriptPath path to an existing file containing a selection script code.
* @return a NativeTask object that can be put in a Job Object.
* @throws InvalidScriptException if an error occurs in definition of selection script
* from file path specified.
*/
private NativeTask createNativeTaskFromCommandString(String command, String taskName, String selectionScriptPath) throws InvalidScriptException {
NativeTask desc = new NativeTask();
desc.setCommandLine(Tools.parseCommandLine(command));
desc.setName(taskName);
if (selectionScriptPath != null) {
SelectionScript script = new SelectionScript(new SimpleScript(new File(selectionScriptPath), null), true);
desc.addSelectionScript(script);
}
return desc;
}
use of org.ow2.proactive.scripting.InvalidScriptException in project scheduling by ow2-proactive.
the class FlowScript method createContinueFlowScript.
public static FlowScript createContinueFlowScript() throws InvalidScriptException {
FlowScript fs = new FlowScript(new SimpleScript("", "javascript"));
fs.setActionType(FlowActionType.CONTINUE);
return fs;
}
use of org.ow2.proactive.scripting.InvalidScriptException in project scheduling by ow2-proactive.
the class ForkedTaskVariablesManagerTest method testAddBindingsToScriptHandlerContainsResultMetadata.
@Test
public void testAddBindingsToScriptHandlerContainsResultMetadata() throws InvalidScriptException, NodeException, NoSuchFieldException, IllegalAccessException {
ScriptHandler scriptHandler = new ScriptHandler();
Map<String, String> resultMetadata = new HashMap<>();
validateThatScriptHandlerBindingsContain(scriptHandler, createTaskContext(null), new VariablesMap(), new HashMap<String, String>(), resultMetadata, SchedulerConstants.RESULT_METADATA_VARIABLE, resultMetadata);
}
use of org.ow2.proactive.scripting.InvalidScriptException in project scheduling by ow2-proactive.
the class ForkedTaskVariablesManagerTest method testAddBindingsToScriptHandlerContainsScratchURI.
@Test
public void testAddBindingsToScriptHandlerContainsScratchURI() throws InvalidScriptException, NodeException, NoSuchFieldException, IllegalAccessException {
ScriptExecutableContainer scriptContainer = createScriptContainer();
TaskLauncherInitializer taskLauncherInitializer = new TaskLauncherInitializer();
taskLauncherInitializer.setForkEnvironment(new ForkEnvironment());
TaskContext taskContext = new TaskContext(scriptContainer, taskLauncherInitializer, null, new NodeDataSpacesURIs(testSetString, null, null, null, null, null), null, null);
// Expect taskResultArray to be inside the map
validateThatScriptHandlerBindingsContain(new ScriptHandler(), taskContext, new VariablesMap(), new HashMap<String, String>(), new HashMap<String, String>(), SchedulerConstants.DS_SCRATCH_BINDING_NAME, testSetString);
}
Aggregations