Search in sources :

Example 86 with TaskFlowJob

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;
}
Also used : TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) EmptyTask(org.ow2.proactive.scheduler.examples.EmptyTask)

Example 87 with TaskFlowJob

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)));
}
Also used : SchedulerTHelper(functionaltests.utils.SchedulerTHelper) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JobState(org.ow2.proactive.scheduler.common.job.JobState) Test(org.junit.Test)

Example 88 with TaskFlowJob

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;
}
Also used : ScriptTask(org.ow2.proactive.scheduler.common.task.ScriptTask) TaskScript(org.ow2.proactive.scripting.TaskScript) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) SimpleScript(org.ow2.proactive.scripting.SimpleScript) JobVariable(org.ow2.proactive.scheduler.common.job.JobVariable)

Example 89 with TaskFlowJob

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);
}
Also used : SchedulerTHelper(functionaltests.utils.SchedulerTHelper) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JobState(org.ow2.proactive.scheduler.common.job.JobState) TaskState(org.ow2.proactive.scheduler.common.task.TaskState) Test(org.junit.Test)

Example 90 with TaskFlowJob

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)));
}
Also used : SchedulerTHelper(functionaltests.utils.SchedulerTHelper) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) Test(org.junit.Test)

Aggregations

TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)184 JavaTask (org.ow2.proactive.scheduler.common.task.JavaTask)92 Test (org.junit.Test)81 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)49 JobId (org.ow2.proactive.scheduler.common.job.JobId)33 File (java.io.File)31 ForkEnvironment (org.ow2.proactive.scheduler.common.task.ForkEnvironment)25 NativeTask (org.ow2.proactive.scheduler.common.task.NativeTask)22 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)21 SimpleScript (org.ow2.proactive.scripting.SimpleScript)20 JobResult (org.ow2.proactive.scheduler.common.job.JobResult)18 ScriptTask (org.ow2.proactive.scheduler.common.task.ScriptTask)16 Task (org.ow2.proactive.scheduler.common.task.Task)16 JobCreationException (org.ow2.proactive.scheduler.common.exception.JobCreationException)13 TaskScript (org.ow2.proactive.scripting.TaskScript)13 JobState (org.ow2.proactive.scheduler.common.job.JobState)12 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)12 ArrayList (java.util.ArrayList)11 TaskResultImpl (org.ow2.proactive.scheduler.task.TaskResultImpl)11 HashMap (java.util.HashMap)10