Search in sources :

Example 91 with JavaTask

use of org.ow2.proactive.scheduler.common.task.JavaTask in project scheduling by ow2-proactive.

the class TaskDBUtilsTest method insertNewJob.

public InternalJob insertNewJob(String user) throws Exception {
    TaskFlowJob jobDef = new TaskFlowJob();
    JavaTask javaTask = createDefaultTask("java task");
    javaTask.setExecutableClassName(TestDummyExecutable.class.getName());
    jobDef.addTask(javaTask);
    return defaultSubmitJob(jobDef, user);
}
Also used : TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask)

Example 92 with JavaTask

use of org.ow2.proactive.scheduler.common.task.JavaTask in project scheduling by ow2-proactive.

the class TestJobRemove method testMultipleDataRemoved.

@Test
public void testMultipleDataRemoved() throws Exception {
    TaskFlowJob jobDef = new TaskFlowJob();
    JavaTask task1 = new JavaTask();
    task1.setName("task1");
    task1.setExecutableClassName(TestDummyExecutable.class.getName());
    jobDef.addTask(task1);
    List<InternalJob> jobs = IntStream.range(0, 5).boxed().map(x -> {
        try {
            return defaultSubmitJob(jobDef);
        } catch (Exception e) {
            return null;
        }
    }).collect(Collectors.toList());
    System.out.println("Remove jobs");
    long start = System.currentTimeMillis();
    dbManager.removeJob(jobs.stream().map(JobState::getId).collect(Collectors.toList()), 0, true);
    System.out.println("Remove time (5 jobs)" + (System.currentTimeMillis() - start));
    checkAllEntitiesDeleted();
}
Also used : IntStream(java.util.stream.IntStream) SelectionScript(org.ow2.proactive.scripting.SelectionScript) Session(org.hibernate.Session) Task(org.ow2.proactive.scheduler.common.task.Task) JobData(org.ow2.proactive.scheduler.core.db.JobData) ArrayList(java.util.ArrayList) ClassMetadata(org.hibernate.metadata.ClassMetadata) TaskResultData(org.ow2.proactive.scheduler.core.db.TaskResultData) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JobContent(org.ow2.proactive.scheduler.core.db.JobContent) JobStatus(org.ow2.proactive.scheduler.common.job.JobStatus) ExecutorService(java.util.concurrent.ExecutorService) ImmutableSet(com.google.common.collect.ImmutableSet) IntRange(groovy.lang.IntRange) Set(java.util.Set) Test(org.junit.Test) JobState(org.ow2.proactive.scheduler.common.job.JobState) Collectors(java.util.stream.Collectors) Executors(java.util.concurrent.Executors) TimeUnit(java.util.concurrent.TimeUnit) TaskResultImpl(org.ow2.proactive.scheduler.task.TaskResultImpl) List(java.util.List) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) SimpleScript(org.ow2.proactive.scripting.SimpleScript) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript) OutputAccessMode(org.ow2.proactive.scheduler.common.task.dataspaces.OutputAccessMode) InputAccessMode(org.ow2.proactive.scheduler.common.task.dataspaces.InputAccessMode) Assert(org.junit.Assert) TaskData(org.ow2.proactive.scheduler.core.db.TaskData) ForkEnvironment(org.ow2.proactive.scheduler.common.task.ForkEnvironment) NativeTask(org.ow2.proactive.scheduler.common.task.NativeTask) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JobState(org.ow2.proactive.scheduler.common.job.JobState) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) Test(org.junit.Test)

Example 93 with JavaTask

use of org.ow2.proactive.scheduler.common.task.JavaTask in project scheduling by ow2-proactive.

the class TestLoadJobsPagination method createJob.

private TaskFlowJob createJob(String name, JobPriority priority, String projectName, Long parentId) throws Exception {
    TaskFlowJob job = new TaskFlowJob();
    if (name != null) {
        job.setName(name);
    } else {
        job.setName(this.getClass().getSimpleName());
    }
    if (projectName != null) {
        job.setProjectName(projectName);
    } else {
        job.setProjectName(this.getClass().getSimpleName() + " project");
    }
    if (priority != null) {
        job.setPriority(priority);
    } else {
        job.setPriority(JobPriority.NORMAL);
    }
    job.setParentId(parentId);
    job.setDescription("TestLoadJobsPagination desc");
    JavaTask task = new JavaTask();
    task.setExecutableClassName("className");
    job.addTask(task);
    return job;
}
Also used : TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask)

Example 94 with JavaTask

use of org.ow2.proactive.scheduler.common.task.JavaTask in project scheduling by ow2-proactive.

the class TestMultipleTasks method testDependencies.

@Test
public void testDependencies() throws Exception {
    TaskFlowJob job = new TaskFlowJob();
    JavaTask task1 = createDefaultTask("task1");
    job.addTask(task1);
    JavaTask task2 = createDefaultTask("task2");
    job.addTask(task2);
    task1.addDependence(task2);
    JavaTask task3 = createDefaultTask("task3");
    job.addTask(task3);
    task2.addDependence(task3);
    InternalJob jobData = defaultSubmitJobAndLoadInternal(true, job);
    Assert.assertEquals(3, jobData.getITasks().size());
    InternalTask taskData1 = jobData.getTask("task1");
    InternalTask taskData2 = jobData.getTask("task2");
    InternalTask taskData3 = jobData.getTask("task3");
    Assert.assertEquals(1, taskData1.getDependences().size());
    Assert.assertEquals(1, taskData2.getDependences().size());
    Assert.assertNull(taskData3.getDependences());
    Assert.assertEquals(taskData2.getId(), taskData1.getDependences().get(0).getId());
    Assert.assertEquals(taskData3.getId(), taskData2.getDependences().get(0).getId());
    Assert.assertEquals(taskData2.getTaskInfo().getTaskId(), taskData1.getDependences().get(0).getTaskInfo().getTaskId());
    Assert.assertEquals(taskData3.getTaskInfo().getTaskId(), taskData2.getDependences().get(0).getTaskInfo().getTaskId());
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) Test(org.junit.Test)

Example 95 with JavaTask

use of org.ow2.proactive.scheduler.common.task.JavaTask in project scheduling by ow2-proactive.

the class TestTaskRuntimeData method testTaskRuntimeData.

@Test
public void testTaskRuntimeData() throws Exception {
    TaskFlowJob job = new TaskFlowJob();
    JavaTask task1 = createDefaultTask("task1");
    task1.setMaxNumberOfExecution(5);
    job.addTask(task1);
    InternalJob jobData = defaultSubmitJobAndLoadInternal(true, job);
    Assert.assertEquals(1, jobData.getITasks().size());
    InternalTask runtimeData = jobData.getITasks().get(0);
    Assert.assertEquals("task1", runtimeData.getName());
    Assert.assertEquals(TaskStatus.SUBMITTED, runtimeData.getStatus());
    Assert.assertEquals(5, runtimeData.getNumberOfExecutionLeft());
    Assert.assertEquals(PASchedulerProperties.NUMBER_OF_EXECUTION_ON_FAILURE.getValueAsInt(), runtimeData.getNumberOfExecutionOnFailureLeft());
    Assert.assertNull(runtimeData.getDependences());
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) Test(org.junit.Test)

Aggregations

TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)104 JavaTask (org.ow2.proactive.scheduler.common.task.JavaTask)104 Test (org.junit.Test)44 ForkEnvironment (org.ow2.proactive.scheduler.common.task.ForkEnvironment)24 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)20 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)18 JobId (org.ow2.proactive.scheduler.common.job.JobId)14 NativeTask (org.ow2.proactive.scheduler.common.task.NativeTask)14 EmptyTask (org.ow2.proactive.scheduler.examples.EmptyTask)13 SelectionScript (org.ow2.proactive.scripting.SelectionScript)12 SimpleScript (org.ow2.proactive.scripting.SimpleScript)12 File (java.io.File)11 TaskResultImpl (org.ow2.proactive.scheduler.task.TaskResultImpl)11 HashMap (java.util.HashMap)10 Task (org.ow2.proactive.scheduler.common.task.Task)9 JobResult (org.ow2.proactive.scheduler.common.job.JobResult)7 ScriptTask (org.ow2.proactive.scheduler.common.task.ScriptTask)6 EmptyExecutable (functionaltests.executables.EmptyExecutable)5 JobDescriptor (org.ow2.proactive.scheduler.common.JobDescriptor)5 Scheduler (org.ow2.proactive.scheduler.common.Scheduler)5