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);
}
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;
}
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);
}
}
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;
}
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);
}
Aggregations