Search in sources :

Example 26 with Client

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

the class SchedulerClientTest method testRMNodeClient.

@Test(timeout = MAX_WAIT_TIME)
public void testRMNodeClient() throws Throwable {
    ISchedulerClient client = clientInstance();
    Job job = nodeClientJob("/functionaltests/descriptors/rm_client_node.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.assertNotNull(tRes);
    Assert.assertTrue(((ArrayList) tRes.value()).get(0) instanceof RMNodeEvent);
}
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) RMNodeEvent(org.ow2.proactive.resourcemanager.common.event.RMNodeEvent) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 27 with Client

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

the class SchedulerClientTest method getResultMap.

@Test(timeout = MAX_WAIT_TIME)
public void getResultMap() throws Throwable {
    ISchedulerClient client = clientInstance();
    Job job = createJob(JobResultTask.class);
    JobId jobId = client.submit(job);
    final JobResult jobResult = client.waitForJob(jobId, TimeUnit.MINUTES.toMillis(2000));
    assertFalse(jobResult.getResultMap().isEmpty());
    Assert.assertEquals(jobResult.getResultMap().get("myvar"), "myvalue");
}
Also used : JobResult(org.ow2.proactive.scheduler.common.job.JobResult) 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 28 with Client

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

the class SchedulerClientTest method testPushPullDeleteEmptyFile.

@Test(timeout = MAX_WAIT_TIME)
public void testPushPullDeleteEmptyFile() throws Exception {
    File emptyFile = File.createTempFile("emptyFile", ".tmp");
    ISchedulerClient client = clientInstance();
    // Push the empty file into the userspace
    client.pushFile("USERSPACE", "", emptyFile.getName(), emptyFile.getCanonicalPath());
    // Delete the local file
    Assert.assertTrue("Unable to delete the local file after push, maybe there are still some open streams?", emptyFile.delete());
    // Pull it from the userspace to be sure that it was pushed
    client.pullFile("USERSPACE", "", emptyFile.getCanonicalPath());
    // Check the file was pulled
    Assert.assertTrue("Unable to pull the empty file, maybe the pull mechanism is broken?", emptyFile.exists());
    // Delete the local file
    Assert.assertTrue("Unable to delete the local file after pull, maybe there are still some open streams?", emptyFile.delete());
    // Delete the file in the user space
    // TODO: TEST THIS
    client.deleteFile("USERSPACE", "/" + emptyFile.getName());
// LATER
}
Also used : ISchedulerClient(org.ow2.proactive.scheduler.rest.ISchedulerClient) File(java.io.File) Test(org.junit.Test)

Example 29 with Client

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

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

the class SchedulerClientTest method testWaitForNonTerminatingJob.

@Test(timeout = MAX_WAIT_TIME, expected = TimeoutException.class)
public void testWaitForNonTerminatingJob() throws Exception {
    ISchedulerClient client = clientInstance();
    Job job = pendingJob();
    JobId jobId = submitJob(job, client);
    try {
        client.waitForJob(jobId, TimeUnit.SECONDS.toMillis(10));
    } finally {
        // Once the TimeoutException has been thrown
        // kill the job to free the node
        client.killJob(jobId);
    }
}
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