String[] taskTrackers = info.getTaskTrackers();
for (String taskTracker : taskTrackers) {
TTInfo ttInfo = wovenClient.getTTInfo(taskTracker);
TTClient ttCli = cluster.getTTClient(ttInfo.getStatus().getHost());
TaskID taskId = info.getTaskID();
TTTaskInfo ttTaskInfo = ttCli.getProxy().getTask(taskId);
Assert.assertNotNull(ttTaskInfo);
Assert.assertNotNull(ttTaskInfo.getConf());
Assert.assertNotNull(ttTaskInfo.getUser());
Assert.assertTrue(ttTaskInfo.getTaskStatus().getProgress() >= 0.0);
Assert.assertTrue(ttTaskInfo.getTaskStatus().getProgress() <= 1.0);
// Get the pid of the task attempt. The task need not have
// reported the pid of the task by the time we are checking
// the pid. So perform null check.
String pid = ttTaskInfo.getPid();
int i = 1;
while (pid.isEmpty()) {
Thread.sleep(1000);
LOG.info("Waiting for task to report its pid back");
ttTaskInfo = ttCli.getProxy().getTask(taskId);
pid = ttTaskInfo.getPid();
if (i == 40) {
Assert.fail("The task pid not reported for 40 seconds.");
}
i++;
}
if (!isOneTaskStored) {
sometaskpid = pid;
sometaskId = ttTaskInfo.getTaskStatus().getTaskID();
myCli = ttCli;
isOneTaskStored = true;
}
LOG.info("verified task progress to be between 0 and 1");
State state = ttTaskInfo.getTaskStatus().getRunState();
if (ttTaskInfo.getTaskStatus().getProgress() < 1.0
&& ttTaskInfo.getTaskStatus().getProgress() > 0.0) {
Assert.assertEquals(TaskStatus.State.RUNNING, state);
LOG.info("verified run state as " + state);
}
FinishTaskControlAction action =
new FinishTaskControlAction(org.apache.hadoop.mapred.TaskID
.downgrade(info.getTaskID()));
ttCli.getProxy().sendAction(action);
}
}
}
rJob.killJob();
int i = 1;
while (!rJob.isComplete()) {
Thread.sleep(1000);
if (i == 40) {
Assert
.fail("The job not completed within 40 seconds after killing it.");
}
i++;
}
TTTaskInfo myTaskInfo = myCli.getProxy().getTask(sometaskId.getTaskID());
i = 0;
while (myTaskInfo != null && !myTaskInfo.getPid().isEmpty()) {
LOG.info("sleeping till task is retired from TT memory");
Thread.sleep(1000);
myTaskInfo = myCli.getProxy().getTask(sometaskId.getTaskID());
if (i == 40) {
Assert