use of org.ow2.proactive.scheduler.common.job.Job in project scheduling by ow2-proactive.
the class GetJobResultCommandTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
DataFaker<JobResultData> jobResultFaker = new DataFaker<JobResultData>(JobResultData.class);
jobResultFaker.setGenerator("id.readableName", new PrefixPropertyGenerator("job", 1));
jobResultFaker.setGenerator("allResults.key", new PrefixPropertyGenerator("task", 1));
jobResultFaker.setGenerator("allResults.value.id.readableName", new PrefixPropertyGenerator("task", 1));
jobResultFaker.setGenerator("allResults.value.serializedValue", new FixedPropertyGenerator(ObjectByteConverter.serializableToBase64String("Hello")));
jobResult = jobResultFaker.fake();
DataFaker<TaskResultData> taskResultsDataFaker = new DataFaker<TaskResultData>(TaskResultData.class);
taskResultsDataFaker.setGenerator("id.readableName", new PrefixPropertyGenerator("task", 4));
taskResultsDataFaker.setGenerator("serializedValue", new FixedPropertyGenerator(ObjectByteConverter.serializableToBase64String("Hello")));
taskResults = taskResultsDataFaker.fakeList(3);
}
use of org.ow2.proactive.scheduler.common.job.Job in project scheduling by ow2-proactive.
the class SchedulerClient method submit.
@Override
public JobId submit(URL job, Map<String, String> variables, Map<String, String> requestHeaderParams) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException {
JobIdData jobIdData = null;
try {
URLConnection urlConnection = job.openConnection();
for (Map.Entry<String, String> requestHeaderEntry : requestHeaderParams.entrySet()) {
urlConnection.addRequestProperty(requestHeaderEntry.getKey(), requestHeaderEntry.getValue());
}
InputStream is = urlConnection.getInputStream();
jobIdData = restApiClient().submitXml(sid, is, variables);
} catch (Exception e) {
throwNCEOrPEOrSCEOrJCE(e);
}
return jobId(jobIdData);
}
use of org.ow2.proactive.scheduler.common.job.Job in project scheduling by ow2-proactive.
the class SchedulerClientTest method testJobSubmissionEventListener.
@Test(timeout = MAX_WAIT_TIME * 2)
public void testJobSubmissionEventListener() throws Exception {
ISchedulerClient client = clientInstance();
SchedulerEventListenerImpl listener = new SchedulerEventListenerImpl();
client.addEventListener(listener, true, SchedulerEvent.JOB_SUBMITTED, SchedulerEvent.USERS_UPDATE);
Job job = defaultJob();
JobId jobId = client.submit(job);
JobState submittedJob = listener.getSubmittedJob();
while (!submittedJob.getId().value().equals(jobId.value())) {
submittedJob = listener.getSubmittedJob();
}
UserIdentification userIdentification = listener.getLastUserUpdate();
assertTrue(userIdentification.getLastSubmitTime() != -1);
client.removeEventListener();
client.waitForJob(jobId, TimeUnit.SECONDS.toMillis(120));
}
use of org.ow2.proactive.scheduler.common.job.Job in project scheduling by ow2-proactive.
the class SchedulerClientTest method testWaitForTerminatingJob.
@Test(timeout = MAX_WAIT_TIME)
public void testWaitForTerminatingJob() throws Exception {
ISchedulerClient client = clientInstance();
Job job = defaultJob();
JobId jobId = submitJob(job, client);
// should return immediately
client.waitForJob(jobId, TimeUnit.MINUTES.toMillis(3));
}
use of org.ow2.proactive.scheduler.common.job.Job in project scheduling by ow2-proactive.
the class SchedulerClientTest method testDataSpaceNodeClientPushDelete.
@Test(timeout = MAX_WAIT_TIME)
public void testDataSpaceNodeClientPushDelete() throws Throwable {
ISchedulerClient client = clientInstance();
Job job = nodeClientJob("/functionaltests/descriptors/dataspace_client_node_push_delete.groovy", "/functionaltests/descriptors/dataspace_client_node_fork.groovy");
JobId jobId = submitJob(job, client);
TaskResult tres = client.waitForTask(jobId.toString(), "NodeClientTask", TimeUnit.MINUTES.toMillis(5));
System.out.println(tres.getOutput().getAllLogs(false));
Assert.assertNotNull(tres);
Assert.assertEquals("OK", tres.value());
}
Aggregations