コード例 #1
0
 /** main program to run on the Collector server */
 public static void main(String argv[]) throws Exception {
   try {
     Configuration conf = new Configuration();
     UtilizationCollector collector = new UtilizationCollector(conf);
     if (collector != null) {
       collector.join();
     }
   } catch (Throwable e) {
     LOG.error(StringUtils.stringifyException(e));
     System.exit(-1);
   }
 }
コード例 #2
0
  protected void initialize(Configuration conf) throws IOException {
    InetSocketAddress socAddr = UtilizationCollector.getAddress(conf);
    int handlerCount = conf.getInt("mapred.resourceutilization.handler.count", 10);

    // create rpc server
    this.server =
        RPC.getServer(this, socAddr.getHostName(), socAddr.getPort(), handlerCount, false, conf);

    // The rpc-server port can be ephemeral... ensure we have the correct info
    this.serverAddress = this.server.getListenerAddress();
    LOG.info("Collector up at: " + this.serverAddress);

    // start RPC server
    this.server.start();

    // How long does the TaskTracker reports expire
    timeLimit = conf.getLong("mapred.resourceutilization.timelimit", DEFAULT_TIME_LIMIT);

    // How long do we consider a job is finished after it stops
    stopTimeLimit =
        conf.getLong("mapred.resourceutilization.stoptimelimit", DEFAULT_STOP_TIME_LIMIT);

    // How often do we aggregate the reports
    aggregatePeriod =
        conf.getLong("mapred.resourceutilization.aggregateperiod", DEFAULT_AGGREGATE_SLEEP_TIME);

    // Start the daemon thread to aggregate the TaskTracker reports
    this.aggregateDaemon = new Daemon(new AggregateRun());
    this.aggregateDaemon.start();
  }