Search in sources :

Example 96 with Scheduler

use of org.ow2.proactive.scheduler.common.Scheduler in project scheduling by ow2-proactive.

the class TestRMProxy method setUp.

@BeforeClass
public static void setUp() throws Exception {
    if (TestScheduler.isStarted()) {
        SchedulerTHelper.log("Killing previous scheduler.");
        TestScheduler.kill();
    }
    rmHelper = new RMTHelper();
    rmHelper.getResourceManager();
    user1Credentials = Credentials.createCredentials(new CredData("admin", "admin"), rmHelper.getRMAuth().getPublicKey());
    user2Credentials = Credentials.createCredentials(new CredData("demo", "demo"), rmHelper.getRMAuth().getPublicKey());
    rmHelper.createNodeSource(nsName, NODES_NUMBER);
}
Also used : RMTHelper(functionaltests.utils.RMTHelper) CredData(org.ow2.proactive.authentication.crypto.CredData)

Example 97 with Scheduler

use of org.ow2.proactive.scheduler.common.Scheduler in project scheduling by ow2-proactive.

the class TestRMProxy method checkSchedulerProxy.

private void checkSchedulerProxy(RMProxiesManager proxiesManager) {
    log("Check scheduler proxy");
    RMProxy proxy = proxiesManager.getRmProxy();
    assertEquals(proxy.getState().getFreeNodesNumber(), NODES_NUMBER);
    assertTrue(proxy.isActive().getBooleanValue());
}
Also used : RMProxy(org.ow2.proactive.scheduler.core.rmproxies.RMProxy)

Example 98 with Scheduler

use of org.ow2.proactive.scheduler.common.Scheduler in project scheduling by ow2-proactive.

the class TestRMReconnectionWhileRunning method testTaskIsNotStuckRunning.

/**
 * This case checks that even if exception was trown in main Scheduler loop it will not cause that jobId is running forever.
 * @throws Exception
 */
@Test
public void testTaskIsNotStuckRunning() throws Exception {
    ProActiveConfiguration.load();
    RMFactory.setOsJavaProperty();
    schedulerHelper = new SchedulerTHelper(false, true);
    schedulerHelper.createNodeSource("local", 3);
    schedulerHelper.getSchedulerInterface().changePolicy("functionaltests.rm.PolicyWhichThrowsExceptions");
    JobId jobId = schedulerHelper.submitJob(new File(runningJob.toURI()).getAbsolutePath());
    JobId jobId2 = schedulerHelper.submitJob(new File(runningJob1.toURI()).getAbsolutePath());
    JobId jobId3 = schedulerHelper.submitJob(new File(runningJob2.toURI()).getAbsolutePath());
    schedulerHelper.waitForEventTaskRunning(jobId, "running_task_for20s");
    schedulerHelper.waitForEventJobFinished(jobId2);
    schedulerHelper.waitForEventJobFinished(jobId3);
    assertJobFinished(jobId2);
    assertJobFinished(jobId3);
    assertJobFinished(jobId);
}
Also used : File(java.io.File) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 99 with Scheduler

use of org.ow2.proactive.scheduler.common.Scheduler in project scheduling by ow2-proactive.

the class TestRunAsMeLinuxNone method testRunAsMe.

@Test
public void testRunAsMe() throws Exception {
    // connect to the scheduler using the runasme account
    Scheduler scheduler = schedulerHelper.getSchedulerInterface(username, password, null);
    JobId jobid = schedulerHelper.testJobSubmission(scheduler, JobFactory.getFactory().createJob(new File(jobDescriptor.toURI()).getAbsolutePath()), false, true);
    for (Map.Entry<String, TaskResult> entry : scheduler.getJobResult(jobid).getAllResults().entrySet()) {
        if (entry.getKey().contains("RunAsMeTask")) {
            Assert.assertTrue("RunAsMe task should display in the logs the correct system user", entry.getValue().getOutput().getStdoutLogs().contains(username));
        }
    }
}
Also used : Scheduler(org.ow2.proactive.scheduler.common.Scheduler) TaskResult(org.ow2.proactive.scheduler.common.task.TaskResult) File(java.io.File) Map(java.util.Map) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 100 with Scheduler

use of org.ow2.proactive.scheduler.common.Scheduler in project scheduling by ow2-proactive.

the class TestRunAsMeLinuxPwd method testRunAsMe.

@Test
public void testRunAsMe() throws Exception {
    // connect to the scheduler using the runasme account
    Scheduler scheduler = schedulerHelper.getSchedulerInterface(username, password, null);
    JobId jobid = schedulerHelper.testJobSubmission(scheduler, JobFactory.getFactory().createJob(new File(jobDescriptor.toURI()).getAbsolutePath()), false, true);
    for (Map.Entry<String, TaskResult> entry : scheduler.getJobResult(jobid).getAllResults().entrySet()) {
        if (entry.getKey().contains("RunAsMeTask")) {
            Assert.assertTrue("RunAsMe task should display in the logs the correct system user", entry.getValue().getOutput().getStdoutLogs().contains(username));
        }
    }
}
Also used : Scheduler(org.ow2.proactive.scheduler.common.Scheduler) TaskResult(org.ow2.proactive.scheduler.common.task.TaskResult) File(java.io.File) Map(java.util.Map) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Aggregations

Scheduler (org.ow2.proactive.scheduler.common.Scheduler)97 JobId (org.ow2.proactive.scheduler.common.job.JobId)51 PermissionException (org.ow2.proactive.scheduler.common.exception.PermissionException)49 NotConnectedException (org.ow2.proactive.scheduler.common.exception.NotConnectedException)46 Path (javax.ws.rs.Path)45 Produces (javax.ws.rs.Produces)43 NotConnectedRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException)42 Test (org.junit.Test)39 PermissionRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.PermissionRestException)38 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)36 File (java.io.File)34 GET (javax.ws.rs.GET)34 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)31 SchedulerRestInterface (org.ow2.proactive_grid_cloud_portal.common.SchedulerRestInterface)31 CLIException (org.ow2.proactive_grid_cloud_portal.cli.CLIException)30 JobState (org.ow2.proactive.scheduler.common.job.JobState)29 UnknownJobRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.UnknownJobRestException)28 GZIP (org.jboss.resteasy.annotations.GZIP)23 KeyException (java.security.KeyException)20 CredData (org.ow2.proactive.authentication.crypto.CredData)19