Search in sources :

Example 76 with Scheduler

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

the class SchedulerStarter method main.

/**
 * Start the scheduler creation process.
 */
public static void main(String[] args) {
    configureSchedulerAndRMAndPAHomes();
    configureSecurityManager();
    configureLogging();
    configureDerby();
    args = JVMPropertiesPreloader.overrideJVMProperties(args);
    Options options = getOptions();
    try {
        CommandLine commandLine = getCommandLine(args, options);
        if (commandLine.hasOption(OPTION_HELP)) {
            displayHelp(options);
        } else {
            start(commandLine);
        }
    } catch (Exception e) {
        LOGGER.error("Error when starting the scheduler", e);
        displayHelp(options);
        System.exit(6);
    }
}
Also used : Options(org.apache.commons.cli.Options) CommandLine(org.apache.commons.cli.CommandLine) LoginException(javax.security.auth.login.LoginException) KeyException(java.security.KeyException) URISyntaxException(java.net.URISyntaxException) InternalSchedulerException(org.ow2.proactive.scheduler.common.exception.InternalSchedulerException) ParseException(org.apache.commons.cli.ParseException) InvalidScriptException(org.ow2.proactive.scripting.InvalidScriptException) SocketException(java.net.SocketException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) ProActiveException(org.objectweb.proactive.core.ProActiveException) AlreadyBoundException(java.rmi.AlreadyBoundException)

Example 77 with Scheduler

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

the class AuthenticationTest method loginAsAdmin.

private void loginAsAdmin(SchedulerAuthenticationInterface auth, PublicKey pubKey) throws KeyException, LoginException, AlreadyConnectedException, NotConnectedException, PermissionException {
    log("Test 1");
    log("Trying to authorized as an admin with correct user name and password");
    Credentials cred = Credentials.createCredentials(new CredData(TestUsers.DEMO.username, TestUsers.DEMO.password), pubKey);
    Scheduler admin = auth.login(cred);
    String userName = admin.getCurrentUser();
    Assert.assertEquals(TestUsers.DEMO.username, userName);
    UserData userData = admin.getCurrentUserData();
    Assert.assertNotNull(userData);
    Assert.assertNotNull(userData.getUserName());
    Assert.assertNotNull(userData.getGroups());
    Assert.assertTrue(userData.getGroups().contains("admin"));
    admin.disconnect();
    log("Passed: successful authentication");
}
Also used : UserData(org.ow2.proactive.authentication.UserData) Scheduler(org.ow2.proactive.scheduler.common.Scheduler) CredData(org.ow2.proactive.authentication.crypto.CredData) Credentials(org.ow2.proactive.authentication.crypto.Credentials)

Example 78 with Scheduler

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

the class SchedulerUsageTest method fallbackToMyAccountUsage.

private void fallbackToMyAccountUsage(Scheduler scheduler) throws NotConnectedException, PermissionException {
    List<JobUsage> asAUser = scheduler.getMyAccountUsage(new Date(0), new Date(0));
    assertNotNull(asAUser);
    // fallback to my account usage
    List<JobUsage> forMyUser = scheduler.getAccountUsage(TestUsers.USER.username, new Date(0), new Date(0));
    assertNotNull(forMyUser);
    try {
        scheduler.getAccountUsage(TestUsers.DEMO.username, new Date(0), new Date(0));
        fail("Should throw permission exception");
    } catch (PermissionException e) {
    }
}
Also used : PermissionException(org.ow2.proactive.scheduler.common.exception.PermissionException) JobUsage(org.ow2.proactive.scheduler.common.usage.JobUsage) Date(java.util.Date)

Example 79 with Scheduler

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

the class TestGetUsers method test.

@Test
public void test() throws Exception {
    // login once with a different user to reset the connection time
    schedulerHelper.getSchedulerInterface(TestUsers.USER);
    // login with the demo user
    Scheduler scheduler = schedulerHelper.getSchedulerInterface();
    List<SchedulerUserInfo> users;
    List<SchedulerUserInfo> usersWithJobs;
    users = scheduler.getUsers();
    assertEquals(1, users.size());
    checkUser(users.get(0), TestUsers.DEMO.username, null);
    assertTrue("Unexpected connect time: " + users.get(0).getConnectionTime(), users.get(0).getConnectionTime() > testStartTime);
    Long connectTime = users.get(0).getConnectionTime();
    scheduler.submit(createJob());
    users = scheduler.getUsers();
    usersWithJobs = scheduler.getUsersWithJobs();
    assertEquals(1, users.size());
    assertEquals(1, usersWithJobs.size());
    checkUser(users.get(0), TestUsers.DEMO.username, connectTime);
    checkUser(usersWithJobs.get(0), TestUsers.DEMO.username, null);
    scheduler.submit(createJob());
    users = scheduler.getUsers();
    usersWithJobs = scheduler.getUsersWithJobs();
    assertEquals(1, users.size());
    assertEquals(1, usersWithJobs.size());
    checkUser(users.get(0), TestUsers.DEMO.username, connectTime);
    checkUser(usersWithJobs.get(0), TestUsers.DEMO.username, null);
}
Also used : SchedulerUserInfo(org.ow2.proactive.scheduler.job.SchedulerUserInfo) Scheduler(org.ow2.proactive.scheduler.common.Scheduler) Test(org.junit.Test)

Example 80 with Scheduler

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

the class TestJobInstantGetTaskResult method testJobInstantGetTaskResult.

@Test
public void testJobInstantGetTaskResult() throws Throwable {
    // create Scheduler client as an active object
    SubmitJob client = (SubmitJob) PAActiveObject.newActive(SubmitJob.class.getName(), new Object[] {});
    // begin to use the client : must be a futur result in order to start the scheduler at next step
    client.begin();
    // create job
    TaskFlowJob job = new TaskFlowJob();
    for (int i = 0; i < 50; i++) {
        JavaTask t = new JavaTask();
        t.setExecutableClassName(ResultAsArray.class.getName());
        t.setName("task" + i);
        job.addTask(t);
    }
    JobId id = schedulerHelper.submitJob(job);
    client.setJobId(id);
    schedulerHelper.waitForEventJobRemoved(id);
    PAActiveObject.terminateActiveObject(client, true);
}
Also used : ResultAsArray(functionaltests.executables.ResultAsArray) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) PAActiveObject(org.objectweb.proactive.api.PAActiveObject) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) 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