Search in sources :

Example 1 with ISchedulerClient

use of org.ow2.proactive.scheduler.rest.ISchedulerClient in project scheduling by ow2-proactive.

the class SchedulerClientTest method testAttachService.

@Test(timeout = MAX_WAIT_TIME)
public void testAttachService() throws Throwable {
    ISchedulerClient client = clientInstance();
    Job job = nodeClientJob("/functionaltests/descriptors/register_service.groovy", null, null);
    JobId jobId = submitJob(job, client);
    client.waitForJob(jobId.toString(), TimeUnit.MINUTES.toMillis(5));
    JobInfo jobInfo = client.getJobInfo(jobId.toString());
    Assert.assertNotNull(jobInfo);
    Assert.assertNotNull(jobInfo.getAttachedServices());
    Assert.assertEquals(1, jobInfo.getAttachedServices().size());
    Assert.assertTrue(jobInfo.getAttachedServices().containsKey(12));
}
Also used : JobInfo(org.ow2.proactive.scheduler.common.job.JobInfo) ISchedulerClient(org.ow2.proactive.scheduler.rest.ISchedulerClient) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) SimpleJob(functionaltests.jobs.SimpleJob) Job(org.ow2.proactive.scheduler.common.job.Job) NonTerminatingJob(functionaltests.jobs.NonTerminatingJob) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 2 with ISchedulerClient

use of org.ow2.proactive.scheduler.rest.ISchedulerClient in project scheduling by ow2-proactive.

the class SchedulerClientTest method createThirdPartyCredentials.

@Test(timeout = MAX_WAIT_TIME)
public void createThirdPartyCredentials() throws Throwable {
    ISchedulerClient client = clientInstance();
    client.putThirdPartyCredential("key/slash", "value/slash");
    Set<String> keySet1 = client.thirdPartyCredentialsKeySet();
    System.out.println("Server Third-Party Credentials : " + keySet1);
    Job job1 = createJob(JobResultTask.class);
    Assert.assertTrue("credentials should contain the key", keySet1.contains("key/slash"));
    client.removeThirdPartyCredential("key/slash");
    Set<String> keySet2 = client.thirdPartyCredentialsKeySet();
    System.out.println("Server Third-Party Credentials : " + keySet2);
    Job job2 = createJob(JobResultTask.class);
    Assert.assertFalse("credentials should not contain the key", keySet2.contains("key/slash"));
}
Also used : ISchedulerClient(org.ow2.proactive.scheduler.rest.ISchedulerClient) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) SimpleJob(functionaltests.jobs.SimpleJob) Job(org.ow2.proactive.scheduler.common.job.Job) NonTerminatingJob(functionaltests.jobs.NonTerminatingJob) Test(org.junit.Test)

Example 3 with ISchedulerClient

use of org.ow2.proactive.scheduler.rest.ISchedulerClient in project scheduling by ow2-proactive.

the class SchedulerClientTest method testAddAndRemoveExternalEndpointUrl.

@Test(timeout = MAX_WAIT_TIME)
public void testAddAndRemoveExternalEndpointUrl() throws Throwable {
    ISchedulerClient client = clientInstance();
    Job job = nodeClientJob("/functionaltests/descriptors/add_and_remove_external_endpoint_urls.groovy", null, null);
    JobId jobId = submitJob(job, client);
    client.waitForJob(jobId.toString(), TimeUnit.MINUTES.toMillis(5));
    JobInfo jobInfo = client.getJobInfo(jobId.toString());
    Assert.assertNotNull(jobInfo);
    Assert.assertNotNull(jobInfo.getExternalEndpointUrls());
    Assert.assertEquals(3, jobInfo.getExternalEndpointUrls().size());
    Assert.assertEquals(new ExternalEndpoint("ccc", "http://ccc.fr", "icon/ccc"), jobInfo.getExternalEndpointUrls().get("ccc"));
    Assert.assertEquals(new ExternalEndpoint("bbb", "http://bbb.fr", "icon/bbb"), jobInfo.getExternalEndpointUrls().get("bbb"));
    // the last endpoint has null icon on purpose (to check that it does not cause issues)
    Assert.assertEquals(new ExternalEndpoint("eee", "http://eee.fr", null), jobInfo.getExternalEndpointUrls().get("eee"));
}
Also used : ExternalEndpoint(org.ow2.proactive.scheduler.job.ExternalEndpoint) JobInfo(org.ow2.proactive.scheduler.common.job.JobInfo) ISchedulerClient(org.ow2.proactive.scheduler.rest.ISchedulerClient) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) SimpleJob(functionaltests.jobs.SimpleJob) Job(org.ow2.proactive.scheduler.common.job.Job) NonTerminatingJob(functionaltests.jobs.NonTerminatingJob) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 4 with ISchedulerClient

use of org.ow2.proactive.scheduler.rest.ISchedulerClient 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();
    Map<String, JobVariable> jobVariables = new LinkedHashMap<>();
    jobVariables.put("MY_VAR", new JobVariable("MY_VAR", "MY_VALUE", "PA:NOT_EMPTY_STRING", "a test variable", "MY_GROUP", true, true));
    job.setVariables(jobVariables);
    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);
    JobInfo jobInfo = client.getJobInfo(jobId.toString());
    System.out.println("Variables = " + jobInfo.getVariables());
    Map<String, JobVariable> stateJobVariables = jobInfo.getDetailedVariables();
    assertEquals(jobVariables, stateJobVariables);
    client.removeEventListener();
    client.waitForJob(jobId, TimeUnit.SECONDS.toMillis(120));
}
Also used : JobInfo(org.ow2.proactive.scheduler.common.job.JobInfo) ISchedulerClient(org.ow2.proactive.scheduler.rest.ISchedulerClient) JobState(org.ow2.proactive.scheduler.common.job.JobState) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) SimpleJob(functionaltests.jobs.SimpleJob) Job(org.ow2.proactive.scheduler.common.job.Job) NonTerminatingJob(functionaltests.jobs.NonTerminatingJob) JobVariable(org.ow2.proactive.scheduler.common.job.JobVariable) UserIdentification(org.ow2.proactive.scheduler.common.job.UserIdentification) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 5 with ISchedulerClient

use of org.ow2.proactive.scheduler.rest.ISchedulerClient in project scheduling by ow2-proactive.

the class SchedulerClientTest method testReSubmitJobWithInfo.

@Test
public void testReSubmitJobWithInfo() throws Exception {
    ISchedulerClient client = clientInstance();
    Job job = nodeClientJob("/functionaltests/descriptors/dataspace_client_node_push_delete.groovy", "/functionaltests/descriptors/dataspace_client_node_fork.groovy", null);
    JobId jobId = submitJob(job, client);
    Map<String, String> infos = new HashMap<>();
    infos.put("myinfo", "myvalue");
    JobId jobId1 = client.reSubmit(jobId, Collections.emptyMap(), infos, null);
    String jobContent1 = client.getJobContent(jobId1);
    assertFalse(jobContent1.contains("<variables>"));
    assertTrue(jobContent1.contains("<genericInformation>"));
    assertTrue(jobContent1.contains("myinfo"));
    assertTrue(jobContent1.contains("myvalue"));
}
Also used : ISchedulerClient(org.ow2.proactive.scheduler.rest.ISchedulerClient) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) SimpleJob(functionaltests.jobs.SimpleJob) Job(org.ow2.proactive.scheduler.common.job.Job) NonTerminatingJob(functionaltests.jobs.NonTerminatingJob) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Aggregations

ISchedulerClient (org.ow2.proactive.scheduler.rest.ISchedulerClient)36 Test (org.junit.Test)34 JobId (org.ow2.proactive.scheduler.common.job.JobId)28 NonTerminatingJob (functionaltests.jobs.NonTerminatingJob)25 SimpleJob (functionaltests.jobs.SimpleJob)25 Job (org.ow2.proactive.scheduler.common.job.Job)25 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)25 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)11 JobInfo (org.ow2.proactive.scheduler.common.job.JobInfo)6 JobResult (org.ow2.proactive.scheduler.common.job.JobResult)5 JobVariable (org.ow2.proactive.scheduler.common.job.JobVariable)4 ConnectionInfo (org.ow2.proactive.authentication.ConnectionInfo)3 File (java.io.File)2 JobState (org.ow2.proactive.scheduler.common.job.JobState)2 ExternalEndpoint (org.ow2.proactive.scheduler.job.ExternalEndpoint)2 ErrorTask (functionaltests.jobs.ErrorTask)1 LogTask (functionaltests.jobs.LogTask)1 MetadataTask (functionaltests.jobs.MetadataTask)1 RawTask (functionaltests.jobs.RawTask)1 VariableTask (functionaltests.jobs.VariableTask)1