use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestTaskResultData method testMultipleJobs.
@Test
public void testMultipleJobs() throws Throwable {
// two jobs have tasks with the same name
TaskFlowJob jobDef1 = new TaskFlowJob();
jobDef1.addTask(createDefaultTask("task1"));
TaskFlowJob jobDef2 = new TaskFlowJob();
jobDef2.addTask(createDefaultTask("task1"));
InternalJob job1 = defaultSubmitJobAndLoadInternal(true, jobDef1);
InternalJob job2 = defaultSubmitJobAndLoadInternal(true, jobDef2);
dbManager.updateAfterTaskFinished(job1, job1.getTask("task1"), new TaskResultImpl(null, new TestResult(0, "job1Res"), null, 0));
dbManager.updateAfterTaskFinished(job2, job2.getTask("task1"), new TaskResultImpl(null, new TestResult(0, "job2Res"), null, 0));
TestResult result;
result = (TestResult) dbManager.loadTaskResult(job1.getId(), "task1", 0).value();
Assert.assertEquals("job1Res", result.getB());
result = (TestResult) dbManager.loadTaskResult(job2.getId(), "task1", 0).value();
Assert.assertEquals("job2Res", result.getB());
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestTaskRuntimeData method testStartJobExecution.
@Test
public void testStartJobExecution() throws Exception {
TaskFlowJob job = new TaskFlowJob();
job.addTask(createDefaultTask("task1"));
job.addTask(createDefaultTask("task2"));
job.addTask(createDefaultTask("task3"));
InternalJob internalJob = defaultSubmitJobAndLoadInternal(true, job);
Assert.assertEquals(TaskStatus.SUBMITTED, internalJob.getTask("task1").getStatus());
Assert.assertEquals(TaskStatus.SUBMITTED, internalJob.getTask("task2").getStatus());
Assert.assertEquals(TaskStatus.SUBMITTED, internalJob.getTask("task3").getStatus());
internalJob.start();
InternalTask task = startTask(internalJob, internalJob.getTask("task1"));
System.out.println("Job started");
dbManager.jobTaskStarted(internalJob, task, true);
internalJob = loadInternalJob(true, internalJob.getId());
Assert.assertEquals(TaskStatus.RUNNING, internalJob.getTask("task1").getStatus());
Assert.assertEquals(TaskStatus.PENDING, internalJob.getTask("task2").getStatus());
Assert.assertEquals(TaskStatus.PENDING, internalJob.getTask("task3").getStatus());
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob 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.job.TaskFlowJob 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.job.TaskFlowJob 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);
}
Aggregations