use of org.ow2.proactive.scheduler.rest.ISchedulerClient in project scheduling by ow2-proactive.
the class SchedulerClientTest method testKillTask.
@Test(timeout = MAX_WAIT_TIME)
public void testKillTask() throws Exception {
ISchedulerClient client = clientInstance();
Job job = createJob(NonTerminatingJob.class);
SchedulerEventListenerImpl listener = new SchedulerEventListenerImpl();
client.addEventListener(listener, true, SchedulerEvent.TASK_PENDING_TO_RUNNING);
JobId jobId = submitJob(job, client);
TaskInfo startedTask = listener.getStartedTask();
while (!startedTask.getJobId().value().equals(jobId.value())) {
startedTask = listener.getStartedTask();
}
client.killTask(jobId, getTaskNameForClass(NonTerminatingJob.class));
client.removeEventListener();
// should return immediately
JobResult result = client.waitForJob(jobId, TimeUnit.MINUTES.toMillis(3));
TaskResult tresult = result.getResult(getTaskName(NonTerminatingJob.class));
Assert.assertTrue(tresult.hadException());
Assert.assertTrue(tresult.getException() instanceof TaskAbortedException);
}
use of org.ow2.proactive.scheduler.rest.ISchedulerClient in project scheduling by ow2-proactive.
the class DataSpaceClient method init.
public void init(ConnectionInfo connectionInfo) throws Exception {
ISchedulerClient client = SchedulerClient.createInstance();
client.init(connectionInfo);
init(connectionInfo.getUrl(), client);
}
Aggregations