Search in sources :

Example 21 with Client

use of org.ow2.proactive.resourcemanager.authentication.Client 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 22 with Client

use of org.ow2.proactive.resourcemanager.authentication.Client 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)

Example 23 with Client

use of org.ow2.proactive.resourcemanager.authentication.Client in project scheduling by ow2-proactive.

the class SchedulerClientTest method testReSubmitJobReplaceInfoValue.

@Test
public void testReSubmitJobReplaceInfoValue() throws Exception {
    ISchedulerClient client = clientInstance();
    Job job = nodeClientJob("/functionaltests/descriptors/dataspace_client_node_push_delete.groovy", "/functionaltests/descriptors/dataspace_client_node_fork.groovy", null);
    Map<String, String> info = new HashMap<>();
    info.put("originalVar", "originalValue");
    job.setGenericInformation(info);
    JobId jobId = submitJob(job, client);
    Map<String, String> info1 = new HashMap<>();
    info1.put("originalVar", "newValue");
    JobId jobId1 = client.reSubmit(jobId, Collections.emptyMap(), info1, null);
    String jobContent1 = client.getJobContent(jobId1);
    assertTrue(jobContent1.contains("<genericInformation>"));
    assertTrue(jobContent1.contains("originalVar"));
    assertTrue(jobContent1.contains("newValue"));
    assertFalse(jobContent1.contains("originalValue"));
    assertFalse(jobContent1.contains("<variables>"));
}
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)

Example 24 with Client

use of org.ow2.proactive.resourcemanager.authentication.Client in project scheduling by ow2-proactive.

the class SchedulerClientTest method testReSubmitJobMergeInfo.

@Test
public void testReSubmitJobMergeInfo() throws Exception {
    ISchedulerClient client = clientInstance();
    Job job = nodeClientJob("/functionaltests/descriptors/dataspace_client_node_push_delete.groovy", "/functionaltests/descriptors/dataspace_client_node_fork.groovy", null);
    Map<String, String> info = new HashMap<>();
    info.put("originalVar", "originalValue");
    job.setGenericInformation(info);
    JobId jobId = submitJob(job, client);
    Map<String, String> info1 = new HashMap<>();
    info1.put("newVar", "newValue");
    JobId jobId1 = client.reSubmit(jobId, Collections.emptyMap(), info1, null);
    String jobContent1 = client.getJobContent(jobId1);
    assertTrue(jobContent1.contains("<genericInformation>"));
    assertTrue(jobContent1.contains("originalVar"));
    assertTrue(jobContent1.contains("originalValue"));
    assertTrue(jobContent1.contains("newVar"));
    assertTrue(jobContent1.contains("newValue"));
    assertFalse(jobContent1.contains("<variables>"));
}
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)

Example 25 with Client

use of org.ow2.proactive.resourcemanager.authentication.Client in project scheduling by ow2-proactive.

the class SchedulerClientTest method testReSubmitJobWithVars.

@Test
public void testReSubmitJobWithVars() 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> vars = new HashMap<>();
    vars.put("myvar", "myvalue");
    JobId jobId1 = client.reSubmit(jobId, vars, Collections.emptyMap(), null);
    String jobContent1 = client.getJobContent(jobId1);
    assertTrue(jobContent1.contains("<variables>"));
    assertTrue(jobContent1.contains("myvar"));
    assertTrue(jobContent1.contains("myvalue"));
    assertFalse(jobContent1.contains("<genericInformation>"));
}
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

Test (org.junit.Test)69 ISchedulerClient (org.ow2.proactive.scheduler.rest.ISchedulerClient)36 Client (org.ow2.proactive.resourcemanager.authentication.Client)31 JobId (org.ow2.proactive.scheduler.common.job.JobId)30 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)28 NonTerminatingJob (functionaltests.jobs.NonTerminatingJob)25 SimpleJob (functionaltests.jobs.SimpleJob)25 Job (org.ow2.proactive.scheduler.common.job.Job)25 ResteasyClient (org.jboss.resteasy.client.jaxrs.ResteasyClient)18 ResteasyWebTarget (org.jboss.resteasy.client.jaxrs.ResteasyWebTarget)18 ListFile (org.ow2.proactive_grid_cloud_portal.dataspace.dto.ListFile)18 File (java.io.File)17 RMNode (org.ow2.proactive.resourcemanager.rmnode.RMNode)13 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)13 NotConnectedRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException)11 Node (org.objectweb.proactive.core.node.Node)9 IOException (java.io.IOException)8 NotConnectedException (org.ow2.proactive.scheduler.common.exception.NotConnectedException)8 JobInfo (org.ow2.proactive.scheduler.common.job.JobInfo)8 NodeSet (org.ow2.proactive.utils.NodeSet)7