Search in sources :

Example 21 with TaskFlowJob

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

the class TestStaxJobFactory method testJobCreationAttributeOrderDefinitionParameterXmlElement.

@Test
public void testJobCreationAttributeOrderDefinitionParameterXmlElement() throws URISyntaxException, JobCreationException, IOException, ClassNotFoundException {
    TaskFlowJob job = (TaskFlowJob) factory.createJob(getResource("job_attr_def_parameter_xml_element.xml"));
    Map<String, Serializable> arguments = ((JavaTask) job.getTask("task")).getArguments();
    assertExpectedKeyValueEntriesMatch(arguments);
}
Also used : Serializable(java.io.Serializable) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) Test(org.junit.Test)

Example 22 with TaskFlowJob

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

the class DefaultModelJobValidatorServiceProviderTest method createJobWithTaskModelVariable.

private TaskFlowJob createJobWithTaskModelVariable(String value, String model) throws UserException {
    TaskFlowJob job = new TaskFlowJob();
    TaskVariable variable = new TaskVariable("VAR", value, model, false);
    Task task = new ScriptTask();
    task.setName("ModelTask");
    task.setVariables(Collections.singletonMap(variable.getName(), variable));
    job.addTask(task);
    return job;
}
Also used : Task(org.ow2.proactive.scheduler.common.task.Task) ScriptTask(org.ow2.proactive.scheduler.common.task.ScriptTask) ScriptTask(org.ow2.proactive.scheduler.common.task.ScriptTask) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) TaskVariable(org.ow2.proactive.scheduler.common.task.TaskVariable)

Example 23 with TaskFlowJob

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

the class InternalJobFactory method createJob.

/**
 * Create a new internal job with the given job (user).
 *
 * @param job the user job that will be used to create the internal job.
 * @return the created internal job.
 * @throws JobCreationException an exception if the factory cannot create the given job.
 */
public static InternalJob createJob(Job job, Credentials cred) throws JobCreationException {
    InternalJob iJob;
    if (logger.isDebugEnabled()) {
        logger.debug("Create job '" + job.getName() + "' - " + job.getClass().getName());
    }
    switch(job.getType()) {
        case PARAMETER_SWEEPING:
            logger.error("The type of the given job is not yet implemented !");
            throw new JobCreationException("The type of the given job is not yet implemented !");
        case TASKSFLOW:
            iJob = createJob((TaskFlowJob) job);
            break;
        default:
            logger.error("The type of the given job is unknown !");
            throw new JobCreationException("The type of the given job is unknown !");
    }
    try {
        // set the job common properties
        iJob.setCredentials(cred);
        setJobCommonProperties(job, iJob);
        return iJob;
    } catch (Exception e) {
        logger.error("", e);
        throw new InternalException("Error while creating the internalJob !", e);
    }
}
Also used : TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JobCreationException(org.ow2.proactive.scheduler.common.exception.JobCreationException) JobCreationException(org.ow2.proactive.scheduler.common.exception.JobCreationException) InvalidScriptException(org.ow2.proactive.scripting.InvalidScriptException) InternalException(org.ow2.proactive.scheduler.common.exception.InternalException) InternalException(org.ow2.proactive.scheduler.common.exception.InternalException)

Example 24 with TaskFlowJob

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

the class TestGetUsers method createJob.

private TaskFlowJob createJob() throws Exception {
    TaskFlowJob job = new TaskFlowJob();
    job.setName(this.getClass().getSimpleName());
    JavaTask task = new JavaTask();
    task.setExecutableClassName(EmptyExecutable.class.getName());
    job.addTask(task);
    return job;
}
Also used : EmptyExecutable(functionaltests.executables.EmptyExecutable) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask)

Example 25 with TaskFlowJob

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

the class TestJobInstantGetTaskResult method testJobInstantGetTaskResult.

@Test
public void testJobInstantGetTaskResult() throws Throwable {
    // create Scheduler client as an active object
    SubmitJob client = (SubmitJob) PAActiveObject.newActive(SubmitJob.class.getName(), new Object[] {});
    // begin to use the client : must be a futur result in order to start the scheduler at next step
    client.begin();
    // create job
    TaskFlowJob job = new TaskFlowJob();
    for (int i = 0; i < 50; i++) {
        JavaTask t = new JavaTask();
        t.setExecutableClassName(ResultAsArray.class.getName());
        t.setName("task" + i);
        job.addTask(t);
    }
    JobId id = schedulerHelper.submitJob(job);
    client.setJobId(id);
    schedulerHelper.waitForEventJobRemoved(id);
    PAActiveObject.terminateActiveObject(client, true);
}
Also used : ResultAsArray(functionaltests.executables.ResultAsArray) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) PAActiveObject(org.objectweb.proactive.api.PAActiveObject) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) JobId(org.ow2.proactive.scheduler.common.job.JobId) 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