Search in sources :

Example 31 with ISchedulerClient

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

the class SchedulerClientTest method testReSubmitJob.

@Test
public void testReSubmitJob() 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);
    JobId jobId1 = client.reSubmit(jobId, Collections.emptyMap(), Collections.emptyMap(), null);
    String jobContent = client.getJobContent(jobId).replaceAll("\\s+", "");
    String jobContent1 = client.getJobContent(jobId1).replaceAll("\\s+", "");
    assertEquals(jobContent, jobContent1);
}
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 32 with ISchedulerClient

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

the class SchedulerClientTest method testReSubmitJobMergeVar.

@Test
public void testReSubmitJobMergeVar() throws Exception {
    ISchedulerClient client = clientInstance();
    Job job = nodeClientJob("/functionaltests/descriptors/dataspace_client_node_push_delete.groovy", "/functionaltests/descriptors/dataspace_client_node_fork.groovy", null);
    job.getVariables().put("originalVar", new JobVariable("originalVar", "originalValue"));
    JobId jobId = submitJob(job, client);
    Map<String, String> vars = new HashMap<>();
    vars.put("newVar", "newValue");
    JobId jobId1 = client.reSubmit(jobId, vars, Collections.emptyMap(), null);
    String jobContent1 = client.getJobContent(jobId1);
    assertTrue(jobContent1.contains("<variables>"));
    assertTrue(jobContent1.contains("originalVar"));
    assertTrue(jobContent1.contains("originalValue"));
    assertTrue(jobContent1.contains("newVar"));
    assertTrue(jobContent1.contains("newValue"));
    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) JobVariable(org.ow2.proactive.scheduler.common.job.JobVariable) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 33 with ISchedulerClient

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

the class SchedulerClientTest method testSchedulerNodeClientParentId.

@Test(timeout = MAX_WAIT_TIME)
public void testSchedulerNodeClientParentId() throws Throwable {
    ISchedulerClient client = clientInstance();
    // Submit a job with the generic informations map
    JobId jobId = client.submit(jobDescriptorParentId);
    TaskResult tres = client.waitForTask(jobId.toString(), "NodeClientTask", TimeUnit.MINUTES.toMillis(5));
    Assert.assertNotNull(tres);
    System.out.println(tres.getOutput().getAllLogs(false));
    Assert.assertFalse(tres.hadException());
    Assert.assertEquals(jobId.value(), tres.value());
}
Also used : ISchedulerClient(org.ow2.proactive.scheduler.rest.ISchedulerClient) TaskResult(org.ow2.proactive.scheduler.common.task.TaskResult) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 34 with ISchedulerClient

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

the class SchedulerClientTest method testDataspaceNodeClientDisconnect.

@Test(timeout = MAX_WAIT_TIME)
public void testDataspaceNodeClientDisconnect() throws Throwable {
    ISchedulerClient client = clientInstance();
    Job job = nodeClientJob("/functionaltests/descriptors/scheduler_client_node_space_disconnect.groovy", null, null);
    JobId jobId = submitJob(job, client);
    TaskResult tres = client.waitForTask(jobId.toString(), "NodeClientTask", TimeUnit.MINUTES.toMillis(5));
    System.out.println(tres.getOutput().getAllLogs(false));
    Assert.assertFalse(tres.hadException());
}
Also used : ISchedulerClient(org.ow2.proactive.scheduler.rest.ISchedulerClient) TaskResult(org.ow2.proactive.scheduler.common.task.TaskResult) 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 35 with ISchedulerClient

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

the class SchedulerClientTest method testDisconnect.

@Test(timeout = MAX_WAIT_TIME)
public void testDisconnect() throws Exception {
    ISchedulerClient client = clientInstance();
    client.disconnect();
    assertFalse(client.isConnected());
    client = clientInstance();
    Assert.assertTrue(client.isConnected());
}
Also used : ISchedulerClient(org.ow2.proactive.scheduler.rest.ISchedulerClient) 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