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);
}
}
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");
}
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) {
}
}
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);
}
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);
}
Aggregations