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));
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestJobAttributes method testJobVariables.
@Test
public void testJobVariables() throws Exception {
TaskFlowJob job = new TaskFlowJob();
InternalJob jobData;
HashMap<String, JobVariable> jobVariables = new HashMap<>();
job.setVariables(jobVariables);
jobData = defaultSubmitJobAndLoadInternal(false, job);
Assert.assertNotNull(jobData.getVariables());
Assert.assertTrue(jobData.getVariables().isEmpty());
jobVariables.put("var1", new JobVariable("var1", "value1", null));
jobVariables.put("var2", new JobVariable("var2", "value2", null));
job.setVariables(jobVariables);
jobVariables = new HashMap<>();
jobVariables.put("var1", new JobVariable("var1", "value1", null));
jobVariables.put("var2", new JobVariable("var2", "value2", null));
job.setVariables(jobVariables);
jobData = defaultSubmitJobAndLoadInternal(false, job);
Assert.assertEquals(2, jobData.getVariables().size());
Assert.assertEquals("value1", jobData.getVariables().get("var1").getValue());
Assert.assertEquals("value2", jobData.getVariables().get("var2").getValue());
StringBuilder longString = new StringBuilder();
for (int i = 0; i < 100; i++) {
longString.append("0123456789abcdefghijklmnopqrstuvwxyz");
}
jobVariables = new HashMap<>();
jobVariables.put("longProperty", new JobVariable("longProperty", longString.toString()));
job.setVariables(jobVariables);
jobData = defaultSubmitJobAndLoadInternal(false, job);
Assert.assertEquals(1, jobData.getVariables().size());
Assert.assertEquals(longString.toString(), jobData.getVariables().get("longProperty").getValue());
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestJobAttributes method testLargeStringValues.
@Test
public void testLargeStringValues() throws Exception {
String description = createString(500);
TaskFlowJob jobDef = new TaskFlowJob();
jobDef.setDescription(description);
InternalJob job = defaultSubmitJobAndLoadInternal(false, jobDef);
Assert.assertEquals(description, job.getDescription());
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestJobAttributes method testGenericInformation.
@Test
public void testGenericInformation() throws Exception {
TaskFlowJob job = new TaskFlowJob();
Map<String, String> genericInfo;
InternalJob jobData;
genericInfo = new HashMap<>();
job.setGenericInformation(genericInfo);
jobData = defaultSubmitJobAndLoadInternal(false, job);
Assert.assertNotNull(jobData.getGenericInformation());
Assert.assertTrue(jobData.getGenericInformation().isEmpty());
genericInfo = new HashMap<>();
genericInfo.put("p1", "v1");
genericInfo.put("p2", "v2");
job.setGenericInformation(genericInfo);
jobData = defaultSubmitJobAndLoadInternal(false, job);
Assert.assertEquals(2, jobData.getGenericInformation().size());
Assert.assertEquals("v1", jobData.getGenericInformation().get("p1"));
Assert.assertEquals("v2", jobData.getGenericInformation().get("p2"));
StringBuilder longString = new StringBuilder();
for (int i = 0; i < 100; i++) {
longString.append("0123456789abcdefghijklmnopqrstuvwxyz");
}
genericInfo = new HashMap<>();
genericInfo.put("longProperty", longString.toString());
job.setGenericInformation(genericInfo);
jobData = defaultSubmitJobAndLoadInternal(false, job);
Assert.assertEquals(1, jobData.getGenericInformation().size());
Assert.assertEquals(longString.toString(), jobData.getGenericInformation().get("longProperty"));
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestJobAttributes method testJobAttribute.
@Test
public void testJobAttribute() throws Exception {
TaskFlowJob job = new TaskFlowJob();
job.setMaxNumberOfExecution(10);
job.setOnTaskError(OnTaskError.CANCEL_JOB);
job.setDescription("desc");
job.setProjectName("project");
job.setName("name");
job.setInputSpace("input");
job.setOutputSpace("output");
job.setGenericInformation(null);
job.setPriority(JobPriority.HIGHEST);
InternalJob jobData = defaultSubmitJob(job, DEFAULT_USER_NAME);
Assert.assertNotNull(jobData.getId());
Assert.assertEquals("name", jobData.getId().getReadableName());
jobData = loadInternalJob(true, jobData.getId());
Assert.assertNotNull(jobData.getId());
Assert.assertEquals("name", jobData.getId().getReadableName());
Assert.assertEquals(10, jobData.getMaxNumberOfExecution());
Assert.assertEquals(OnTaskError.CANCEL_JOB, jobData.getOnTaskErrorProperty().getValue());
Assert.assertEquals("name", jobData.getName());
Assert.assertEquals("desc", jobData.getDescription());
Assert.assertEquals("project", jobData.getProjectName());
Assert.assertEquals("input", jobData.getInputSpace());
Assert.assertEquals("output", jobData.getOutputSpace());
Assert.assertEquals(JobPriority.HIGHEST, jobData.getPriority());
Assert.assertNotNull(jobData.getGenericInformation());
Assert.assertTrue(jobData.getGenericInformation().isEmpty());
Map<String, JobVariable> jobDataVariables = jobData.getVariables();
Assert.assertNotNull(jobDataVariables);
Assert.assertTrue(jobDataVariables.isEmpty());
}
Aggregations