use of org.ow2.proactive.scheduler.task.TaskLauncherInitializer in project scheduling by ow2-proactive.
the class TaskContextVariableExtractorTest method testExtractTaskResultVariablesGetAllNonTaskVariables.
@Test
public void testExtractTaskResultVariablesGetAllNonTaskVariables() throws Exception {
ScriptExecutableContainer scriptContainer = new ScriptExecutableContainer(new TaskScript(new SimpleScript("print('hello'); result='hello'", "javascript")));
TaskLauncherInitializer taskLauncherInitializer = getTaskLauncherInitializerWithWorkflowVariables();
TaskContext taskContext = new TaskContext(scriptContainer, taskLauncherInitializer, null, new NodeDataSpacesURIs(null, null, null, null, null, null), null, null);
Map<String, Serializable> scopeVariables = new TaskContextVariableExtractor().getAllNonTaskVariables(taskContext);
Assert.assertThat(scopeVariables.toString(), CoreMatchers.containsString("PA_TASK_NAME=TestTaskName"));
}
use of org.ow2.proactive.scheduler.task.TaskLauncherInitializer in project scheduling by ow2-proactive.
the class TaskContextVariableExtractorTest method testExtractThrowsExceptionIfVariablesAreInvalidByteStream.
@Test(expected = Exception.class)
public void testExtractThrowsExceptionIfVariablesAreInvalidByteStream() throws Exception {
ScriptExecutableContainer scriptContainer = new ScriptExecutableContainer(new TaskScript(new SimpleScript("print('hello'); result='hello'", "javascript")));
TaskLauncherInitializer taskLauncherInitializer = getTaskLauncherInitializerWithWorkflowVariables();
Map<String, byte[]> taskResultVariables = new HashMap<>();
// The task result variables are expected to be converted to byte streams.
taskResultVariables.put(taskResultPropagatedVariables1Key, taskResultPropagatedVariables1Value.getBytes());
TaskResultImpl taskResult = new TaskResultImpl(taskLauncherInitializer.getTaskId(), new Exception("Exception"));
taskResult.setPropagatedVariables(taskResultVariables);
TaskResult[] taskResultArray = { taskResult };
TaskContext taskContext = new TaskContext(scriptContainer, taskLauncherInitializer, taskResultArray, new NodeDataSpacesURIs(null, null, null, null, null, null), null, null);
new TaskContextVariableExtractor().getAllVariables(taskContext);
}
use of org.ow2.proactive.scheduler.task.TaskLauncherInitializer in project scheduling by ow2-proactive.
the class ForkedProcessBuilderCreatorTest method createTaskLauncherInitializer.
private TaskLauncherInitializer createTaskLauncherInitializer() {
TaskLauncherInitializer taskLauncherInitializer = new TaskLauncherInitializer();
TaskId taskId = createTaskId();
taskLauncherInitializer.setTaskId(taskId);
taskLauncherInitializer.setIterationIndex(iterationIndexValue);
taskLauncherInitializer.setJobOwner(jobOwnerValue);
taskLauncherInitializer.setReplicationIndex(taskReplicationValue);
return taskLauncherInitializer;
}
use of org.ow2.proactive.scheduler.task.TaskLauncherInitializer in project scheduling by ow2-proactive.
the class ForkedJvmTaskExecutionCommandCreatorTest method createTaskContext.
private TaskContext createTaskContext() throws InvalidScriptException, NodeException {
ScriptExecutableContainer scriptContainer = new ScriptExecutableContainer(new TaskScript(new SimpleScript("print('hello'); result='hello'", "javascript")));
TaskLauncherInitializer taskLauncherInitializer = getTaskLauncherInitializerWithWorkflowVariableAndForkEnvironment();
TaskContext taskContext = new TaskContext(scriptContainer, taskLauncherInitializer, null, new NodeDataSpacesURIs(null, null, null, null, null, null), null, null);
return taskContext;
}
use of org.ow2.proactive.scheduler.task.TaskLauncherInitializer in project scheduling by ow2-proactive.
the class ForkedJvmTaskExecutionCommandCreatorTest method createTaskLauncherInitializer.
private TaskLauncherInitializer createTaskLauncherInitializer() {
TaskLauncherInitializer taskLauncherInitializer = new TaskLauncherInitializer();
TaskId taskId = createTaskId();
taskLauncherInitializer.setTaskId(taskId);
taskLauncherInitializer.setIterationIndex(iterationIndexValue);
taskLauncherInitializer.setJobOwner(jobOwnerValue);
taskLauncherInitializer.setReplicationIndex(taskReplicationValue);
return taskLauncherInitializer;
}
Aggregations