Search in sources :

Example 1 with TaskFlowJob

use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.

the class TestInMemorySchedulerDB method sanityTestJobContent.

@Test
public void sanityTestJobContent() throws Exception {
    SchedulerDBManager dbManager = SchedulerDBManager.createInMemorySchedulerDBManager();
    TaskFlowJob jobDef = new TaskFlowJob();
    jobDef.addTask(BaseSchedulerDBTest.createDefaultTask("task1"));
    jobDef.addTask(BaseSchedulerDBTest.createDefaultTask("task2"));
    jobDef.addTask(BaseSchedulerDBTest.createDefaultTask("task3"));
    InternalJob job = InternalJobFactory.createJob(jobDef, BaseSchedulerDBTest.getDefaultCredentials());
    job.setOwner("test");
    dbManager.newJobSubmitted(job);
    Job content = dbManager.loadInitalJobContent(job.getId());
    Assert.assertTrue(content instanceof TaskFlowJob);
    Assert.assertThat(((TaskFlowJob) content).getTasks().size(), is(3));
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) SchedulerDBManager(org.ow2.proactive.scheduler.core.db.SchedulerDBManager) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) Job(org.ow2.proactive.scheduler.common.job.Job) Test(org.junit.Test) ProActiveTest(org.ow2.tests.ProActiveTest)

Example 2 with TaskFlowJob

use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.

the class TestLoadJobsPagination method createJob.

private TaskFlowJob createJob() throws Exception {
    TaskFlowJob job = new TaskFlowJob();
    job.setName(this.getClass().getSimpleName());
    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 3 with TaskFlowJob

use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.

the class TestProcessTreeKiller method createJavaExecutableJob.

public static TaskFlowJob createJavaExecutableJob(String name, boolean forked) throws UserException {
    TaskFlowJob job = new TaskFlowJob();
    job.setName(name);
    job.setDescription("A command that spawns processes");
    JavaTask task = new JavaTask();
    if (forked) {
        task.setForkEnvironment(new ForkEnvironment());
    }
    task.addArgument("sleep", 3);
    task.addArgument("tname", name);
    task.addArgument("home", PASchedulerProperties.SCHEDULER_HOME.getValueAsString());
    task.setName(name);
    task.setExecutableClassName(JavaSpawnExecutable.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) ForkEnvironment(org.ow2.proactive.scheduler.common.task.ForkEnvironment)

Example 4 with TaskFlowJob

use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.

the class ValidationUtil method fillUpdatedVariables.

private void fillUpdatedVariables(TaskFlowJob job, JobValidationData data) {
    HashMap<String, String> updatedVariables = new HashMap<>();
    for (JobVariable jobVariable : job.getVariables().values()) {
        updatedVariables.put(jobVariable.getName(), jobVariable.getValue());
    }
    for (Task task : job.getTasks()) {
        for (TaskVariable taskVariable : task.getVariables().values()) {
            updatedVariables.put(task.getName() + ":" + taskVariable.getName(), taskVariable.getValue());
        }
    }
    data.setUpdatedVariables(updatedVariables);
}
Also used : Task(org.ow2.proactive.scheduler.common.task.Task) HashMap(java.util.HashMap) TaskVariable(org.ow2.proactive.scheduler.common.task.TaskVariable) JobVariable(org.ow2.proactive.scheduler.common.job.JobVariable)

Example 5 with TaskFlowJob

use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.

the class AbstractRestFuncTestCase method createJob.

protected Job createJob(Class<?> clazz) throws Exception {
    TaskFlowJob job = new TaskFlowJob();
    job.setName(clazz.getSimpleName());
    job.setPriority(JobPriority.NORMAL);
    job.setOnTaskError(OnTaskError.CANCEL_JOB);
    job.setDescription("Test " + clazz.getSimpleName());
    job.setMaxNumberOfExecution(1);
    JavaTask task = new JavaTask();
    task.setName(getTaskNameForClass(clazz));
    task.setExecutableClassName(clazz.getName());
    task.setMaxNumberOfExecution(1);
    task.setOnTaskError(OnTaskError.CANCEL_JOB);
    String classpath = RestFuncTUtils.getClassPath(clazz);
    ForkEnvironment forkEnvironment = new ForkEnvironment();
    forkEnvironment.addAdditionalClasspath(classpath);
    task.setForkEnvironment(forkEnvironment);
    job.addTask(task);
    return job;
}
Also used : TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) ForkEnvironment(org.ow2.proactive.scheduler.common.task.ForkEnvironment)

Aggregations

TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)226 Test (org.junit.Test)106 JavaTask (org.ow2.proactive.scheduler.common.task.JavaTask)103 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)52 File (java.io.File)35 JobId (org.ow2.proactive.scheduler.common.job.JobId)35 ForkEnvironment (org.ow2.proactive.scheduler.common.task.ForkEnvironment)27 NativeTask (org.ow2.proactive.scheduler.common.task.NativeTask)27 Task (org.ow2.proactive.scheduler.common.task.Task)23 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)23 SimpleScript (org.ow2.proactive.scripting.SimpleScript)23 JobCreationException (org.ow2.proactive.scheduler.common.exception.JobCreationException)21 GlobalVariablesParserTest (org.ow2.proactive.scheduler.common.job.factories.globalvariables.GlobalVariablesParserTest)21 JobResult (org.ow2.proactive.scheduler.common.job.JobResult)20 ScriptTask (org.ow2.proactive.scheduler.common.task.ScriptTask)20 JobVariable (org.ow2.proactive.scheduler.common.job.JobVariable)18 JobState (org.ow2.proactive.scheduler.common.job.JobState)15 TaskScript (org.ow2.proactive.scripting.TaskScript)15 HashMap (java.util.HashMap)14 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)14