use of org.apache.samza.rest.model.Job in project samza by apache.
the class YarnCliJobStatusProvider method getJobStatus.
@Override
public Job getJobStatus(JobInstance jobInstance) throws IOException, InterruptedException {
Job info = new Job(jobInstance.getJobName(), jobInstance.getJobId());
getJobStatuses(Collections.singletonList(info));
return info;
}
use of org.apache.samza.rest.model.Job in project samza by apache.
the class TestJobsResource method testGetJobs.
@Test
public void testGetJobs() throws IOException {
Response resp = target("v1/jobs").request().get();
assertEquals(200, resp.getStatus());
final Job[] jobs = objectMapper.readValue(resp.readEntity(String.class), Job[].class);
assertEquals(4, jobs.length);
assertEquals(MockJobProxy.JOB_INSTANCE_1_NAME, jobs[0].getJobName());
assertEquals(MockJobProxy.JOB_INSTANCE_1_ID, jobs[0].getJobId());
assertStatusNotDefault(jobs[0]);
assertEquals(MockJobProxy.JOB_INSTANCE_2_NAME, jobs[1].getJobName());
assertEquals(MockJobProxy.JOB_INSTANCE_2_ID, jobs[1].getJobId());
assertStatusNotDefault(jobs[1]);
assertEquals(MockJobProxy.JOB_INSTANCE_3_NAME, jobs[2].getJobName());
assertEquals(MockJobProxy.JOB_INSTANCE_3_ID, jobs[2].getJobId());
assertStatusNotDefault(jobs[2]);
assertEquals(MockJobProxy.JOB_INSTANCE_4_NAME, jobs[3].getJobName());
assertEquals(MockJobProxy.JOB_INSTANCE_4_ID, jobs[3].getJobId());
assertStatusNotDefault(jobs[3]);
resp.close();
}
use of org.apache.samza.rest.model.Job in project samza by apache.
the class TestJobsResource method testStopJob.
@Test
public void testStopJob() throws IOException {
Response resp = target(String.format("v1/jobs/%s/%s", MockJobProxy.JOB_INSTANCE_2_NAME, MockJobProxy.JOB_INSTANCE_2_ID)).queryParam("status", "stopped").request().put(Entity.form(new Form()));
assertEquals(202, resp.getStatus());
final Job job2 = objectMapper.readValue(resp.readEntity(String.class), Job.class);
assertEquals(MockJobProxy.JOB_INSTANCE_2_NAME, job2.getJobName());
assertEquals(MockJobProxy.JOB_INSTANCE_2_ID, job2.getJobId());
assertStatusNotDefault(job2);
resp.close();
}
use of org.apache.samza.rest.model.Job in project samza by apache.
the class MockJobStatusProvider method getJobStatus.
@Override
public Job getJobStatus(JobInstance jobInstance) throws IOException, InterruptedException {
Job info = new Job(jobInstance.getJobName(), jobInstance.getJobId());
setStatusStarted(info);
return info;
}
use of org.apache.samza.rest.model.Job in project samza by apache.
the class TestJobsResource method testGetJob.
@Test
public void testGetJob() throws IOException {
Response resp = target(String.format("v1/jobs/%s/%s", MockJobProxy.JOB_INSTANCE_2_NAME, MockJobProxy.JOB_INSTANCE_2_ID)).request().get();
assertEquals(200, resp.getStatus());
final Job job2 = objectMapper.readValue(resp.readEntity(String.class), Job.class);
assertEquals(MockJobProxy.JOB_INSTANCE_2_NAME, job2.getJobName());
assertEquals(MockJobProxy.JOB_INSTANCE_2_ID, job2.getJobId());
assertStatusNotDefault(job2);
resp.close();
}
Aggregations