use of org.ow2.proactive.scheduler.common.Scheduler in project scheduling by ow2-proactive.
the class TestSmartProxy method init.
@Before
public void init() throws Exception {
// because of https://issues.jenkins-ci.org/browse/JENKINS-29285, test is unstable on windows
assumeTrue(OperatingSystem.getOperatingSystem() != OperatingSystem.windows);
// log all data transfer related events
ProActiveLogger.getLogger(SchedulerProxyUserInterface.class).setLevel(Level.DEBUG);
workLocalFolder = new File(workFolderPath);
inputLocalFolder = new File(workLocalFolder, "input");
outputLocalFolder = new File(workLocalFolder, "output");
inputLocalFolder.mkdirs();
outputLocalFolder.mkdirs();
// ----------------- start Data Server -------------
// this simulates a remote data server
// dataServerURI =
// dataProvider.deployProActiveDataServer(dataServerFolderPath, "data");
dataServerURI = (new File(dataServerFolderPath)).toURI().toURL().toExternalForm();
// start scheduler and nodes
schedulerHelper.getSchedulerAuth();
schedProxy = SmartProxyImpl.getActiveInstance();
schedProxy.cleanDatabase();
String schedulerUrl = SchedulerTHelper.getLocalUrl();
schedProxy.setSessionName(TEST_SESSION_NAME);
schedProxy.init(new ConnectionInfo(schedulerUrl, TestUsers.DEMO.username, TestUsers.DEMO.password, null, true));
eventListener = new MyEventListener();
MyEventListener myListenerRemoteReference = PAActiveObject.turnActive(eventListener);
schedProxy.addEventListener(myListenerRemoteReference);
}
use of org.ow2.proactive.scheduler.common.Scheduler in project scheduling by ow2-proactive.
the class TestKillWhenInStoppedState method testTaskAndJobKilling.
@Test
public void testTaskAndJobKilling() throws Exception {
Scheduler scheduler = schedulerHelper.getSchedulerInterface();
test(SchedulerStatus.FROZEN);
if (!scheduler.resume()) {
Assert.fail("Failed to resume scheduler");
}
test(SchedulerStatus.PAUSED);
if (!scheduler.resume()) {
Assert.fail("Failed to resume scheduler");
}
test(SchedulerStatus.STOPPED);
if (!scheduler.start()) {
Assert.fail("Failed to start scheduler");
}
}
use of org.ow2.proactive.scheduler.common.Scheduler in project scheduling by ow2-proactive.
the class TestLicensePolicy method testLicensePolicy.
/**
* Tests that two independent tasks do not run at the same time, due to license limitation.
*
* @throws Exception
*/
@Test
public void testLicensePolicy() throws Throwable {
JobId jobId = schedulerHelper.submitJob(new File(jobDescriptor.toURI()).getAbsolutePath());
log("Waiting for job finished");
schedulerHelper.waitForEventJobFinished(jobId);
Scheduler scheduler = schedulerHelper.getSchedulerInterface();
TaskState taskState0 = scheduler.getJobState(jobId).getTasks().get(0);
TaskState taskState1 = scheduler.getJobState(jobId).getTasks().get(1);
boolean tasksExecutedOneByOne = (taskState0.getFinishedTime() < taskState1.getStartTime()) || (taskState1.getFinishedTime() < taskState0.getStartTime());
Assert.assertTrue(tasksExecutedOneByOne);
}
use of org.ow2.proactive.scheduler.common.Scheduler in project scheduling by ow2-proactive.
the class RunningTaskRecoveryWhenNodesAreReservedInBatchTest method printJobStateAndReturnNumberOfRunningTasks.
private void printJobStateAndReturnNumberOfRunningTasks(JobId jobid) throws Exception {
Scheduler scheduler = schedulerHelper.getSchedulerInterface();
JobState jobState;
int numberOfPendingTasks;
int numberOfRunningTasks;
jobState = scheduler.getJobState(jobid);
numberOfPendingTasks = jobState.getNumberOfPendingTasks();
numberOfRunningTasks = jobState.getNumberOfRunningTasks();
int numberOfFinishedTasks = jobState.getNumberOfFinishedTasks();
int numberOfInErrorTasks = jobState.getNumberOfInErrorTasks();
SchedulerTHelper.log("Number of pending tasks " + numberOfPendingTasks);
SchedulerTHelper.log("Number of running tasks " + numberOfRunningTasks);
SchedulerTHelper.log("Number of finished tasks " + numberOfFinishedTasks);
SchedulerTHelper.log("Number of in error tasks " + numberOfInErrorTasks);
}
use of org.ow2.proactive.scheduler.common.Scheduler in project scheduling by ow2-proactive.
the class RunningTaskRecoveryWhenNodesAreReservedInBatchTest method action.
@Test
public void action() throws Throwable {
nodes = schedulerHelper.createRMNodeStarterNodes(RunningTaskRecoveryWhenNodesAreReservedInBatchTest.class.getSimpleName(), NB_NODES);
for (int i = 0; i < NB_NODES; i++) {
schedulerHelper.waitForAnyNodeEvent(RMEventType.NODE_ADDED);
}
JobId jobid = schedulerHelper.submitJob(new File(JOB_DESCRIPTOR.toURI()).getAbsolutePath());
schedulerHelper.waitForEventJobRunning(jobid);
schedulerHelper.waitForEventTaskFinished(jobid, "Groovy_Task");
JobState jobState = schedulerHelper.getSchedulerInterface().getJobState(jobid);
SchedulerTHelper.log("Total number of tasks: " + jobState.getTotalNumberOfTasks());
List<TaskState> tasks = jobState.getTasks();
TaskState fifthTask = tasks.get(5);
SchedulerTHelper.log("Wait for the fifth task running");
// we wait for the fifth task to be running so that when we kill the
// scheduler we have a mix of pending/submitted/running tasks
schedulerHelper.waitForEventTaskRunning(fifthTask.getJobId(), fifthTask.getName());
SchedulerTHelper.log("Fifth task is running");
// restart scheduler
printRmStateAndReturnNotFreeNodeNumber();
printJobStateAndReturnNumberOfRunningTasks(jobid);
TestScheduler.kill();
schedulerHelper = new SchedulerTHelper(false, new File(SCHEDULER_CONFIGURATION_RESTART.toURI()).getAbsolutePath(), new File(RM_CONFIGURATION_RESTART.toURI()).getAbsolutePath(), null, false);
SchedulerTHelper.log("Wait for job to finish");
JobInfo jobInfo = schedulerHelper.waitForEventJobFinished(jobid);
assertThat(jobInfo.getNumberOfFailedTasks()).isEqualTo(0);
assertThat(jobInfo.getNumberOfInErrorTasks()).isEqualTo(0);
// wait for all nodes released
while (printRmStateAndReturnNotFreeNodeNumber() != 0) {
schedulerHelper.waitForAnyNodeEvent(RMEventType.NODE_STATE_CHANGED);
}
// all nodes should be free now
int notFreeNodeNumber = printRmStateAndReturnNotFreeNodeNumber();
assertThat(notFreeNodeNumber).isEqualTo(0);
}
Aggregations