public TaskTrackerInfo[] getActiveTrackers() throws IOException, InterruptedException { try { return TypeConverter.fromYarnNodes( client.getNodeReports(NodeState.RUNNING)); } catch (YarnException e) { throw new IOException(e); } }
private Collection<String> arrayToStringList(TaskTrackerInfo[] objs) { Collection<String> list = new ArrayList<String>(); for (TaskTrackerInfo info: objs) { list.add(info.getTaskTrackerName()); } return list; }
private Collection<BlackListInfo> arrayToBlackListInfo(TaskTrackerInfo[] objs) { Collection<BlackListInfo> list = new ArrayList<BlackListInfo>(); for (TaskTrackerInfo info: objs) { BlackListInfo binfo = new BlackListInfo(); binfo.setTrackerName(info.getTaskTrackerName()); binfo.setReasonForBlackListing(info.getReasonForBlacklist()); binfo.setBlackListReport(info.getBlacklistReport()); list.add(binfo); } return list; }
/** * Display the list of active trackers */ private void listActiveTrackers(Cluster cluster) throws IOException, InterruptedException { TaskTrackerInfo[] trackers = cluster.getActiveTaskTrackers(); for (TaskTrackerInfo tracker : trackers) { System.out.println(tracker.getTaskTrackerName()); } }
/** * Display the list of blacklisted trackers */ private void listBlacklistedTrackers(Cluster cluster) throws IOException, InterruptedException { TaskTrackerInfo[] trackers = cluster.getBlackListedTaskTrackers(); if (trackers.length > 0) { System.out.println("BlackListedNode \t Reason"); } for (TaskTrackerInfo tracker : trackers) { System.out.println(tracker.getTaskTrackerName() + "\t" + tracker.getReasonForBlacklist()); } }