use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class ParallelTaskSchedulingTest method createJob.
private TaskFlowJob createJob(int numberOfTasks) throws UserException {
TaskFlowJob job = new TaskFlowJob();
for (int i = 0; i < numberOfTasks; i++) {
JavaTask task = new JavaTask();
task.setName("JavaTask_" + i);
task.setExecutableClassName(EmptyTask.class.getName());
job.addTask(task);
}
return job;
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class ParallelTaskSchedulingTest method test.
@Test(timeout = 3600000)
public void test() throws Exception {
ProActiveConfiguration.load();
RMFactory.setOsJavaProperty();
schedulerHelper = new SchedulerTHelper(false, SCHEDULER_CONFIGURATION_START.getPath(), RM_CONFIGURATION_START.getPath(), null);
schedulerHelper.createNodeSourceWithInfiniteTimeout("local", numberOfNodes);
final TaskFlowJob job = createJob(numberOfTasks);
jobId = schedulerHelper.submitJob(job);
schedulerHelper.waitForEventJobFinished(jobId);
final JobState jobState = schedulerHelper.getSchedulerInterface().getJobState(jobId);
final long timeToMeasure = jobState.getFinishedTime() - jobState.getStartTime();
LOGGER.info(makeCSVString(ParallelTaskSchedulingTest.class.getSimpleName(), numberOfTasks, timeLimit, timeToMeasure, ((timeToMeasure < timeLimit) ? SUCCESS : FAILURE)));
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class SchedulerEfficiencyMetricsTest method createJob.
public static TaskFlowJob createJob(int taskNumber, int taskDuration) throws Exception {
final TaskFlowJob job = new TaskFlowJob();
job.setName(String.format("EP_%d_NO_MERGE_%dSEC", taskNumber, taskDuration));
job.setOnTaskError(OnTaskError.CANCEL_JOB);
job.getVariables().put(OPTIMAL_JOB_DURATION, new JobVariable(OPTIMAL_JOB_DURATION, String.valueOf(taskDuration)));
for (int i = 0; i < taskNumber; i++) {
ScriptTask task = new ScriptTask();
task.setName("process_" + i);
task.setScript(new TaskScript(new SimpleScript(String.format("Thread.sleep(%s)", taskDuration), "groovy")));
job.addTask(task);
}
return job;
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class SchedulerEfficiencyMetricsTest method test.
@Test(timeout = 3600000)
public void test() throws Exception {
ProActiveConfiguration.load();
RMFactory.setOsJavaProperty();
schedulerHelper = new SchedulerTHelper(false, SCHEDULER_CONFIGURATION_START.getPath(), RM_CONFIGURATION_START.getPath(), null);
schedulerHelper.createNodeSourceWithInfiniteTimeout("local", taskNumber);
final TaskFlowJob job = createJob(taskNumber, TASK_DURATION);
long start = System.currentTimeMillis();
jobId = schedulerHelper.submitJob(job);
long submited = System.currentTimeMillis();
schedulerHelper.waitForEventJobFinished(jobId);
final JobState jobState = schedulerHelper.getSchedulerInterface().getJobState(jobId);
final long finished = jobState.getFinishedTime();
long latestTaskStart = Long.MIN_VALUE;
for (TaskState taskState : jobState.getTasks()) {
if (taskState.getStartTime() > latestTaskStart) {
latestTaskStart = taskState.getStartTime();
}
}
long TCT = submited - start;
long TST = latestTaskStart - submited;
long TTT = finished - latestTaskStart - TASK_DURATION;
logAndAssert("TaskCreationTimeTest", TCT);
logAndAssert("TaskSchedulingTimeTest", TST);
logAndAssert("TaskTerminationTimeTest", TTT);
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TaskCreationTimeTest method taskCreationRate.
@Test(timeout = 3600000)
public void taskCreationRate() throws Exception {
ProActiveConfiguration.load();
RMFactory.setOsJavaProperty();
schedulerHelper = new SchedulerTHelper(false, SCHEDULER_CONFIGURATION_START.getPath(), RM_CONFIGURATION_START.getPath(), null);
schedulerHelper.createNodeSourceWithInfiniteTimeout("local", 1);
final TaskFlowJob job = SchedulerEfficiencyMetricsTest.createJob(taskNumber, TASK_DURATION);
final long start = System.currentTimeMillis();
jobId = schedulerHelper.submitJob(job);
final long anActualTime = System.currentTimeMillis() - start;
LOGGER.info(makeCSVString(TaskCreationTimeTest.class.getSimpleName(), taskNumber, timeLimit, anActualTime, ((anActualTime < timeLimit) ? SUCCESS : FAILURE)));
}
Aggregations