@Test public void testJobToString() throws IOException, InterruptedException { Cluster cluster = mock(Cluster.class); ClientProtocol client = mock(ClientProtocol.class); when(cluster.getClient()).thenReturn(client); JobID jobid = new JobID("1014873536921", 6); JobStatus status = new JobStatus(jobid, 0.0f, 0.0f, 0.0f, 0.0f, State.FAILED, JobPriority.DEFAULT, "root", "TestJobToString", "job file", "tracking url"); when(client.getJobStatus(jobid)).thenReturn(status); when(client.getTaskReports(jobid, TaskType.MAP)).thenReturn( new TaskReport[0]); when(client.getTaskReports(jobid, TaskType.REDUCE)).thenReturn( new TaskReport[0]); when(client.getTaskCompletionEvents(jobid, 0, 10)).thenReturn( new TaskCompletionEvent[0]); Job job = Job.getInstance(cluster, status, new JobConf()); Assert.assertNotNull(job.toString()); }
@Override public TaskCompletionEvent[] run() throws IOException, InterruptedException { return cluster.getClient().getTaskCompletionEvents( status.getJobID(), 0, 10); } });
@Override public TaskCompletionEvent[] run() throws IOException, InterruptedException { return cluster.getClient().getTaskCompletionEvents( status.getJobID(), 0, 10); } });
@Override public TaskCompletionEvent[] run() throws IOException, InterruptedException { return cluster.getClient().getTaskCompletionEvents(getJobID(), startFrom, numEvents); } });
@Override public TaskCompletionEvent[] run() throws IOException, InterruptedException { return cluster.getClient().getTaskCompletionEvents(getJobID(), startFrom, numEvents); } });
@Override public TaskCompletionEvent[] run() throws IOException, InterruptedException { return cluster.getClient().getTaskCompletionEvents(getJobID(), startFrom, numEvents); } });
@Override public TaskCompletionEvent[] run() throws IOException, InterruptedException { return cluster.getClient().getTaskCompletionEvents( status.getJobID(), 0, 10); } });
@Override public TaskCompletionEvent[] run() throws IOException, InterruptedException { return cluster.getClient().getTaskCompletionEvents( status.getJobID(), 0, 10); } });
@Override public TaskCompletionEvent[] run() throws IOException, InterruptedException { return cluster.getClient().getTaskCompletionEvents(getJobID(), startFrom, numEvents); } });
/** * Get events indicating completion (success/failure) of component tasks. * * @param startFrom index to start fetching events from * @param numEvents number of events to fetch * @return an array of {@link TaskCompletionEvent}s * @throws IOException */ public TaskCompletionEvent[] getTaskCompletionEvents(int startFrom, int numEvents) throws IOException, InterruptedException { ensureState(JobState.RUNNING); return cluster.getClient().getTaskCompletionEvents(getJobID(), startFrom, numEvents); }