use of org.ow2.proactive.scheduler.common.task.JavaTask in project scheduling by ow2-proactive.
the class TestTaskAttributes method testAttributes.
@Test
public void testAttributes() throws Exception {
JavaTask task = createDefaultTask("task");
task.setOnTaskError(OnTaskError.CANCEL_JOB);
task.setDescription("desc");
// TODO: create test using valid flow
// task.setFlowBlock(FlowBlock.START);
task.setMaxNumberOfExecution(7);
task.setPreciousLogs(true);
task.setPreciousResult(true);
task.setRunAsMe(true);
task.setWallTime(123);
InternalTask taskData = saveSingleTask(task).getTask(task.getName());
Assert.assertEquals(OnTaskError.CANCEL_JOB, taskData.getOnTaskErrorProperty().getValue());
Assert.assertEquals("desc", taskData.getDescription());
// Assert.assertEquals(FlowBlock.START, taskData.getFlowBlock());
Assert.assertEquals(7, taskData.getMaxNumberOfExecution());
Assert.assertEquals("task", taskData.getName());
Assert.assertEquals(true, taskData.isPreciousLogs());
Assert.assertEquals(true, taskData.isPreciousResult());
Assert.assertEquals(true, taskData.isRunAsMe());
Assert.assertEquals(123, taskData.getWallTime());
}
use of org.ow2.proactive.scheduler.common.task.JavaTask in project scheduling by ow2-proactive.
the class TestUsageData method createJob.
private TaskFlowJob createJob(String name, String... taskNames) throws Exception {
TaskFlowJob job = new TaskFlowJob();
job.setName(name);
job.setPriority(JobPriority.IDLE);
for (String taskName : taskNames) {
JavaTask task = new JavaTask();
task.setName(taskName);
task.setExecutableClassName("className");
job.addTask(task);
}
return job;
}
use of org.ow2.proactive.scheduler.common.task.JavaTask in project scheduling by ow2-proactive.
the class TestSmartProxy method createTestJob.
protected TaskFlowJob createTestJob(boolean isolateOutputs) throws Exception {
TaskFlowJob job = new TaskFlowJob();
job.setName(this.getClass().getSimpleName());
ForkEnvironment forkEnvironment = new ForkEnvironment();
forkEnvironment.addAdditionalClasspath(getClasspath(job));
for (int i = 0; i < NB_TASKS; i++) {
JavaTask testTask = new JavaTask();
testTask.setName(TASK_NAME + i);
testTask.setExecutableClassName(SimpleJavaExecutable.class.getName());
testTask.setForkEnvironment(forkEnvironment);
// testTask.
// ------------- create an input File ------------
File inputFile = new File(inputLocalFolder, inputFileBaseName + "_" + i + inputFileExt);
String outputFileName = outputFileBaseName + "_" + i + outputFileExt;
// delete files after the test is finished
File outputFile = new File(outputLocalFolder, outputFileName);
outputFile.deleteOnExit();
inputFile.deleteOnExit();
FileWriter fw = new FileWriter(inputFile);
for (int j = 0; j <= Math.round(Math.random() * 100) + 1; j++) fw.write("Some random input");
fw.close();
// Add dummy input files, make sure no error happen
testTask.addInputFiles("DUMMY", InputAccessMode.TransferFromInputSpace);
testTask.addInputFiles(inputFile.getName(), InputAccessMode.TransferFromInputSpace);
if (isolateOutputs) {
testTask.addOutputFiles("*" + outputFileExt, OutputAccessMode.TransferToOutputSpace);
} else {
testTask.addOutputFiles(outputFileName, OutputAccessMode.TransferToOutputSpace);
}
job.addTask(testTask);
}
job.setInputSpace(dataServerURI);
job.setOutputSpace(dataServerURI);
return job;
}
use of org.ow2.proactive.scheduler.common.task.JavaTask in project scheduling by ow2-proactive.
the class TestKillTaskWhileExecutingScripts method javaTaskKillEndlessPreScript.
public void javaTaskKillEndlessPreScript() throws Throwable {
log("Test Java Task : killing an Endless PreScript ...");
String tname = "javaTaskKillEndlessPreScript";
// pre script interruption
TaskFlowJob job = new TaskFlowJob();
job.setName(this.getClass().getSimpleName() + "_" + tname);
JavaTask task1 = new JavaTask();
task1.setName(tname);
task1.setExecutableClassName(EmptyExecutable.class.getName());
task1.setPreScript(endlessScript);
job.addTask(task1);
submitAndCheckJob(job, tname);
}
use of org.ow2.proactive.scheduler.common.task.JavaTask 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;
}
Aggregations