本文整理汇总了Java中org.apache.hadoop.tools.rumen.ClusterStory类的典型用法代码示例。如果您正苦于以下问题:Java ClusterStory类的具体用法?Java ClusterStory怎么用?Java ClusterStory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClusterStory类属于org.apache.hadoop.tools.rumen包,在下文中一共展示了ClusterStory类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startTaskTrackers
import org.apache.hadoop.tools.rumen.ClusterStory; //导入依赖的package包/类
/**
* Start simulated task trackers based on topology.
* @param clusterStory The cluster topology.
* @param now
* time stamp when the simulator is started, {@link SimulatorTaskTracker}s
* are started shortly after this time stamp
*/
void startTaskTrackers(ClusterStory clusterStory, long now) {
/** port assigned to TTs, incremented by 1 for each TT */
int port = 10000;
long ms = now + 100;
for (MachineNode node : clusterStory.getMachines()) {
String hostname = node.getName();
RackNode rackNode = node.getRackNode();
StaticMapping.addNodeToRack(hostname, rackNode.getName());
String taskTrackerName = "tracker_" + hostname + ":localhost/127.0.0.1:"
+ port;
port++;
SimulatorTaskTracker tt = new SimulatorTaskTracker(jt, taskTrackerName,
hostname, node.getMapSlots(), node.getReduceSlots());
queue.addAll(tt.init(ms++));
}
}
示例2: startTaskTrackers
import org.apache.hadoop.tools.rumen.ClusterStory; //导入依赖的package包/类
/**
* Start simulated task trackers based on topology.
* @param clusterStory the cluster topology.
* @param jobConf configuration object.
* @param now
* time stamp when the simulator is started, {@link SimulatorTaskTracker}s
* are started uniformly randomly spread in [now,now+startDuration).
* @return time stamp by which the entire cluster is booted up and all task
* trackers are sending hearbeats in their steady rate.
*/
long startTaskTrackers(ClusterStory cluster, JobConf jobConf, long now) {
/** port assigned to TTs, incremented by 1 for each TT */
int port = 10000;
int numTaskTrackers = 0;
Random random = new Random(RandomSeedGenerator.getSeed(
"forStartTaskTrackers()", masterRandomSeed));
final int startDuration = jobConf.getInt("mumak.cluster.startup.duration",
DEFAULT_CLUSTER_STARTUP_DURATION);
for (MachineNode node : cluster.getMachines()) {
jobConf.set("mumak.tasktracker.host.name", node.getName());
jobConf.set("mumak.tasktracker.tracker.name",
"tracker_" + node.getName() + ":localhost/127.0.0.1:" + port);
long subRandomSeed = RandomSeedGenerator.getSeed(
"forTaskTracker" + numTaskTrackers, masterRandomSeed);
jobConf.setLong("mumak.tasktracker.random.seed", subRandomSeed);
numTaskTrackers++;
port++;
SimulatorTaskTracker tt = new SimulatorTaskTracker(jt, jobConf);
long firstHeartbeat = now + random.nextInt(startDuration);
queue.addAll(tt.init(firstHeartbeat));
}
// In startDuration + heartbeat interval of the full cluster time each
// TT is started up and told on its 2nd heartbeat to beat at a rate
// corresponding to the steady state of the cluster
long clusterSteady = now + startDuration + jt.getNextHeartbeatInterval();
return clusterSteady;
}