use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestKillWhenInStoppedState method createPendingJob.
private TaskFlowJob createPendingJob() throws Exception {
TaskFlowJob job = new TaskFlowJob();
job.setName("Test pending job");
job.setOnTaskError(OnTaskError.CONTINUE_JOB_EXECUTION);
JavaTask javaTask = new JavaTask();
javaTask.setExecutableClassName(TestJavaTask.class.getName());
javaTask.setName(TASK_NAME2);
javaTask.setSelectionScript(new SelectionScript("selected = false;", "JavaScript", false));
job.addTask(javaTask);
return job;
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestProcessTreeKiller method createJavaExecutableJob.
public static TaskFlowJob createJavaExecutableJob(String name, boolean forked) throws UserException {
TaskFlowJob job = new TaskFlowJob();
job.setName(name);
job.setDescription("A command that spawns processes");
JavaTask task = new JavaTask();
if (forked) {
task.setForkEnvironment(new ForkEnvironment());
}
task.addArgument("sleep", 3);
task.addArgument("tname", name);
task.addArgument("home", PASchedulerProperties.SCHEDULER_HOME.getValueAsString());
task.setName(name);
task.setExecutableClassName(JavaSpawnExecutable.class.getName());
job.addTask(task);
return job;
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestForkedTaskWorkingDir method javaTaskTaskRestartedAnotherNode.
/*
* SCHEDULING-2129 Mapping for a given space URI is already registered
*
* Run a task, kill the node,let it restart on another node and check the the shared scratch
* space was correctly setup by transferring a file created in working dir from the task
*/
private void javaTaskTaskRestartedAnotherNode() throws Exception {
FileLock blockTaskFromTest = new FileLock();
Path blockTaskFromTestPath = blockTaskFromTest.lock();
FileLock blockTestBeforeKillingNode = new FileLock();
Path blockTestBeforeKillingNodePath = blockTestBeforeKillingNode.lock();
TaskFlowJob job = createFileInLocalSpaceJob(blockTaskFromTestPath.toString(), blockTestBeforeKillingNodePath.toString());
JobId idJ1 = schedulerHelper.submitJob(job);
SchedulerTHelper.log("Wait until task is in the middle of the run");
final String taskNodeUrl = findNodeRunningTask();
schedulerHelper.waitForEventTaskRunning(idJ1, "task1");
FileLock.waitUntilUnlocked(blockTestBeforeKillingNodePath);
SchedulerTHelper.log("Kill the node running the task");
schedulerHelper.killNode(taskNodeUrl);
SchedulerTHelper.log("Let the task finish");
blockTaskFromTest.unlock();
SchedulerTHelper.log("Waiting for job 1 to finish");
schedulerHelper.waitForEventJobFinished(idJ1);
String userSpaceUri = URI.create(schedulerHelper.getSchedulerInterface().getUserSpaceURIs().get(0)).getPath();
assertTrue("Could not find expected output file", new File(userSpaceUri, "output_file.txt").exists());
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestForkedTaskWorkingDir method nativeTask.
private void nativeTask() throws Exception {
if (OperatingSystem.getOperatingSystem() == OperatingSystem.unix) {
File input = createTempDirectory("test", ".input_native", null);
File output = createTempDirectory("test", ".output_native", null);
FileUtils.touch(new File(input, "inputFile_native.txt"));
TaskFlowJob job = (TaskFlowJob) StaxJobFactory.getFactory().createJob(new File(TestForkedTaskWorkingDir.class.getResource("/functionaltests/descriptors/Job_forked_native_task_working_dir.xml").toURI()).getAbsolutePath());
job.setInputSpace(input.toURI().toString());
job.setOutputSpace(output.toURI().toString());
schedulerHelper.testJobSubmission(job);
assertTrue(new File(output, "outputFile_native.txt").exists());
}
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestForkedTaskWorkingDir method createFileInLocalSpaceJob.
private TaskFlowJob createFileInLocalSpaceJob(String blockTaskFromTestUrl, String blockTestBeforeKillingNodeUrl) throws Exception {
TaskFlowJob job = new TaskFlowJob();
JavaTask task1 = new JavaTask();
task1.setForkEnvironment(new ForkEnvironment());
task1.setName("task1");
task1.setExecutableClassName(CreateFileInLocalSpaceTask.class.getName());
task1.addArgument("blockTaskFromTestUrl", blockTaskFromTestUrl);
task1.addArgument("blockTestBeforeKillingNodeUrl", blockTestBeforeKillingNodeUrl);
task1.addOutputFiles("output_file.txt", OutputAccessMode.TransferToUserSpace);
job.addTask(task1);
return job;
}
Aggregations