use of org.ow2.proactive.scheduler.common.job.JobResult in project scheduling by ow2-proactive.
the class ComplexTypeArgsTest method testComplexTypeArgs.
@Test
public void testComplexTypeArgs() throws Throwable {
TaskFlowJob submittedJob = new TaskFlowJob();
JavaTask task = new JavaTask();
task.setName("t1");
task.setExecutableClassName(ComplexParamsExecutable.class.getName());
task.addArgument("param1", new UserTypeA(3));
submittedJob.addTask(task);
// test submission and event reception
JobId id = schedulerHelper.testJobSubmission(submittedJob);
// check job results
JobResult res = schedulerHelper.getJobResult(id);
assertFalse(res.hadException());
}
use of org.ow2.proactive.scheduler.common.job.JobResult in project scheduling by ow2-proactive.
the class TestMultipleUsersMakingMassivGetResultRequest method testMultipleUsersMakingMassivGetResultRequest.
@Test
public void testMultipleUsersMakingMassivGetResultRequest() throws Throwable {
final SchedulerAuthenticationInterface auth = schedulerHelper.getSchedulerAuth();
// create a job
final TaskFlowJob job = new TaskFlowJob();
for (int i = 0; i < taskPerJob; i++) {
JavaTask task = new JavaTask();
task.setName("jt" + i);
task.setExecutableClassName(EmptyTask.class.getName());
job.addTask(task);
}
// start threads
for (int i = 0; i < ThreadNumber; i++) {
new Thread() {
@Override
public void run() {
try {
// connect the scheduler
log(Thread.currentThread().getName() + " -> Connecting the scheduler");
Credentials cred = Credentials.createCredentials(new CredData(TestUsers.DEMO.username, TestUsers.DEMO.password), auth.getPublicKey());
Scheduler user = auth.login(cred);
log(Thread.currentThread().getName() + " -> Connected");
long start = System.currentTimeMillis();
int submitted = 1;
while (true) {
log(Thread.currentThread().getName() + " -> Submit (" + submitted + ")");
JobId id = user.submit(job);
JobResult jr = null;
while (jr == null) {
Thread.sleep(getResultDelay);
jr = user.getJobResult(id);
}
if (System.currentTimeMillis() - start > jobSubmissionDuration) {
log(Thread.currentThread().getName() + " -> Terminate");
nbFinished++;
break;
}
submitted++;
}
} catch (Exception e) {
e.printStackTrace();
}
}
}.start();
}
while (nbFinished < ThreadNumber) {
Thread.sleep(100);
}
log("All threads terminated.");
}
use of org.ow2.proactive.scheduler.common.job.JobResult in project scheduling by ow2-proactive.
the class TestCleanTaskWorkingDir method input_files_are_in_working_dir_for_forked_tasks.
@Test
public void input_files_are_in_working_dir_for_forked_tasks() throws Throwable {
TaskFlowJob job = (TaskFlowJob) StaxJobFactory.getFactory().createJob(new File(TestCleanTaskWorkingDir.class.getResource("/functionaltests/descriptors/Job_fill_working_dir_script_task.xml").toURI()).getAbsolutePath());
JobId id = schedulerHelper.testJobSubmission(job);
assertFalse(schedulerHelper.getJobResult(id).hadException());
JobResult jobResult = schedulerHelper.getJobResult(id);
TaskResult taskResult = jobResult.getResult("fill_working_dir_task");
String workingDirPath = taskResult.getOutput().getAllLogs(false);
Assert.assertFalse(new File(workingDirPath).exists());
}
use of org.ow2.proactive.scheduler.common.job.JobResult in project scheduling by ow2-proactive.
the class SchedulerDBManager method loadJobResult.
@SuppressWarnings("unchecked")
private JobResultImpl loadJobResult(Session session, Query query, JobData job, JobId jobId) {
JobResultImpl jobResult = new JobResultImpl();
jobResult.setJobInfo(job.createJobInfo(jobId));
DBTaskId currentTaskId = null;
List<Object[]> resultList = (List<Object[]>) query.list();
if (resultList.isEmpty()) {
return jobResult;
}
int counter = 0;
for (Object[] result : resultList) {
TaskResultData resultData = (TaskResultData) result[0];
DBTaskId dbTaskId = (DBTaskId) result[1];
String taskName = (String) result[2];
Boolean preciousResult = (Boolean) result[3];
boolean nextTask = !dbTaskId.equals(currentTaskId);
if (nextTask) {
TaskId taskId = TaskIdImpl.createTaskId(jobId, taskName, dbTaskId.getTaskId());
jobResult.addTaskResult(taskName, resultData.toTaskResult(taskId), preciousResult);
currentTaskId = dbTaskId;
}
if (++counter % 100 == 0) {
session.clear();
}
}
return jobResult;
}
use of org.ow2.proactive.scheduler.common.job.JobResult in project scheduling by ow2-proactive.
the class TestKillWhenInStoppedState method printJobResult.
private void printJobResult(Scheduler scheduler, JobId jobId) throws Exception {
JobResult jobResult = scheduler.getJobResult(jobId);
for (TaskResult taskResult : jobResult.getAllResults().values()) {
System.out.println("Task " + taskResult.getTaskId());
if (taskResult.getException() != null) {
System.out.println("Exception: " + taskResult.getException());
}
System.out.println("Task output:");
System.out.println(taskResult.getOutput().getAllLogs(false));
}
}
Aggregations