return ret;
}
public static ThriftClusterStatus toThrift(ClusterStatus cs,
JobTracker tracker) {
ThriftClusterStatus tcs = new ThriftClusterStatus();
tcs.setNumActiveTrackers(cs.getTaskTrackers());
tcs.setActiveTrackerNames(new ArrayList<String>(cs.getActiveTrackerNames()));
tcs.setBlacklistedTrackerNames(new ArrayList<String>(cs.getBlacklistedTrackerNames()));
tcs.setNumBlacklistedTrackers(cs.getBlacklistedTrackers());
tcs.setNumExcludedNodes(0);
tcs.setTaskTrackerExpiryInterval(cs.getTTExpiryInterval());
tcs.setMapTasks(cs.getMapTasks());
tcs.setReduceTasks(cs.getReduceTasks());
tcs.setMaxMapTasks(cs.getMaxMapTasks());
tcs.setMaxReduceTasks(cs.getMaxReduceTasks());
tcs.setState(cs.getJobTrackerStatus() == Cluster.JobTrackerStatus.INITIALIZING ? JobTrackerState.INITIALIZING :
JobTrackerState.RUNNING);
tcs.setUsedMemory(cs.getUsedMemory());
tcs.setMaxMemory(cs.getMaxMemory());
tcs.setTotalSubmissions(tracker.getTotalSubmissions());
tcs.setHasRecovered(tracker.hasRecovered());
tcs.setHasRestarted(tracker.hasRestarted());
tcs.setHostname(tracker.getJobTrackerMachine());
tcs.setIdentifier(tracker.getTrackerIdentifier());
tcs.setStartTime(tracker.getStartTime());
tcs.setHttpPort(tracker.getInfoPort());
return tcs;
}