Search in sources :

Example 36 with ISchedulerClient

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);
}
Also used : TaskInfo(org.ow2.proactive.scheduler.common.task.TaskInfo) JobResult(org.ow2.proactive.scheduler.common.job.JobResult) ISchedulerClient(org.ow2.proactive.scheduler.rest.ISchedulerClient) TaskResult(org.ow2.proactive.scheduler.common.task.TaskResult) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) SimpleJob(functionaltests.jobs.SimpleJob) Job(org.ow2.proactive.scheduler.common.job.Job) NonTerminatingJob(functionaltests.jobs.NonTerminatingJob) TaskAbortedException(org.ow2.proactive.scheduler.common.exception.TaskAbortedException) JobId(org.ow2.proactive.scheduler.common.job.JobId) NonTerminatingJob(functionaltests.jobs.NonTerminatingJob) Test(org.junit.Test)

Example 37 with ISchedulerClient

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);
}
Also used : ISchedulerClient(org.ow2.proactive.scheduler.rest.ISchedulerClient)

Aggregations

ISchedulerClient (org.ow2.proactive.scheduler.rest.ISchedulerClient)36 Test (org.junit.Test)34 JobId (org.ow2.proactive.scheduler.common.job.JobId)28 NonTerminatingJob (functionaltests.jobs.NonTerminatingJob)25 SimpleJob (functionaltests.jobs.SimpleJob)25 Job (org.ow2.proactive.scheduler.common.job.Job)25 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)25 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)11 JobInfo (org.ow2.proactive.scheduler.common.job.JobInfo)6 JobResult (org.ow2.proactive.scheduler.common.job.JobResult)5 JobVariable (org.ow2.proactive.scheduler.common.job.JobVariable)4 ConnectionInfo (org.ow2.proactive.authentication.ConnectionInfo)3 File (java.io.File)2 JobState (org.ow2.proactive.scheduler.common.job.JobState)2 ExternalEndpoint (org.ow2.proactive.scheduler.job.ExternalEndpoint)2 ErrorTask (functionaltests.jobs.ErrorTask)1 LogTask (functionaltests.jobs.LogTask)1 MetadataTask (functionaltests.jobs.MetadataTask)1 RawTask (functionaltests.jobs.RawTask)1 VariableTask (functionaltests.jobs.VariableTask)1