Package org.apache.hadoop.mapreduce

Examples of org.apache.hadoop.mapreduce.ClusterMetrics


   */
  public ClusterStatus getClusterStatus() throws IOException {
    try {
      return clientUgi.doAs(new PrivilegedExceptionAction<ClusterStatus>() {
        public ClusterStatus run()  throws IOException, InterruptedException {
          ClusterMetrics metrics = cluster.getClusterStatus();
          return new ClusterStatus(metrics.getTaskTrackerCount(),
              metrics.getBlackListedTaskTrackerCount(), cluster.getTaskTrackerExpiryInterval(),
              metrics.getOccupiedMapSlots(),
              metrics.getOccupiedReduceSlots(), metrics.getMapSlotCapacity(),
              metrics.getReduceSlotCapacity(),
              cluster.getJobTrackerStatus(),
              metrics.getDecommissionedTaskTrackerCount());
        }
      });
    }
      catch (InterruptedException ie) {
      throw new IOException(ie);
View Full Code Here


   */
  public ClusterStatus getClusterStatus(boolean detailed) throws IOException {
    try {
      return clientUgi.doAs(new PrivilegedExceptionAction<ClusterStatus>() {
        public ClusterStatus run() throws IOException, InterruptedException {
        ClusterMetrics metrics = cluster.getClusterStatus();
        return new ClusterStatus(arrayToStringList(cluster.getActiveTaskTrackers()),
          arrayToBlackListInfo(cluster.getBlackListedTaskTrackers()),
          cluster.getTaskTrackerExpiryInterval(), metrics.getOccupiedMapSlots(),
          metrics.getOccupiedReduceSlots(), metrics.getMapSlotCapacity(),
          metrics.getReduceSlotCapacity(),
          cluster.getJobTrackerStatus());
        }
      });
    } catch (InterruptedException ie) {
      throw new IOException(ie);
View Full Code Here

   */
  public ClusterStatus getClusterStatus() throws IOException {
    try {
      return clientUgi.doAs(new PrivilegedExceptionAction<ClusterStatus>() {
        public ClusterStatus run()  throws IOException, InterruptedException {
          ClusterMetrics metrics = cluster.getClusterStatus();
          return new ClusterStatus(metrics.getTaskTrackerCount(),
              metrics.getBlackListedTaskTrackerCount(), cluster.getTaskTrackerExpiryInterval(),
              metrics.getOccupiedMapSlots(),
              metrics.getOccupiedReduceSlots(), metrics.getMapSlotCapacity(),
              metrics.getReduceSlotCapacity(),
              cluster.getJobTrackerStatus(),
              metrics.getDecommissionedTaskTrackerCount());
        }
      });
    }
      catch (InterruptedException ie) {
      throw new IOException(ie);
View Full Code Here

   */
  public ClusterStatus getClusterStatus(boolean detailed) throws IOException {
    try {
      return clientUgi.doAs(new PrivilegedExceptionAction<ClusterStatus>() {
        public ClusterStatus run() throws IOException, InterruptedException {
        ClusterMetrics metrics = cluster.getClusterStatus();
        return new ClusterStatus(arrayToStringList(cluster.getActiveTaskTrackers()),
          arrayToBlackListInfo(cluster.getBlackListedTaskTrackers()),
          cluster.getTaskTrackerExpiryInterval(), metrics.getOccupiedMapSlots(),
          metrics.getOccupiedReduceSlots(), metrics.getMapSlotCapacity(),
          metrics.getReduceSlotCapacity(),
          cluster.getJobTrackerStatus());
        }
      });
    } catch (InterruptedException ie) {
      throw new IOException(ie);
View Full Code Here

  }

  public ClusterMetrics getClusterMetrics() throws IOException,
      InterruptedException {
    YarnClusterMetrics metrics = super.getYarnClusterMetrics();
    ClusterMetrics oldMetrics = new ClusterMetrics(1, 1, 1, 1, 1, 1,
        metrics.getNumNodeManagers() * 10, metrics.getNumNodeManagers() * 2, 1,
        metrics.getNumNodeManagers(), 0, 0);
    return oldMetrics;
  }
View Full Code Here

  public ClusterMetrics getClusterMetrics() throws IOException,
      InterruptedException {
    GetClusterMetricsRequest request = recordFactory.newRecordInstance(GetClusterMetricsRequest.class);
    GetClusterMetricsResponse response = applicationsManager.getClusterMetrics(request);
    YarnClusterMetrics metrics = response.getClusterMetrics();
    ClusterMetrics oldMetrics = new ClusterMetrics(1, 1, 1, 1, 1, 1,
        metrics.getNumNodeManagers() * 10, metrics.getNumNodeManagers() * 2, 1,
        metrics.getNumNodeManagers(), 0, 0);
    return oldMetrics;
  }
View Full Code Here

    return fs.getUri().toString();
  }
 
  public ClusterMetrics getClusterMetrics() {
    int numMapTasks = map_tasks.get();
    return new ClusterMetrics(numMapTasks, reduce_tasks, numMapTasks,
        reduce_tasks, 0, 0, 1, 1, jobs.size(), 1, 0, 0);
  }
View Full Code Here

    private Machine chooseMachine(Configuration conf) throws IOException {
      final int parts = conf.getInt(N_PARTS, Integer.MAX_VALUE);
      try {
        for(;; Thread.sleep(2000)) {
          //get cluster status
          final ClusterMetrics status = cluster.getClusterStatus();
          final int m =
            status.getMapSlotCapacity() - status.getOccupiedMapSlots();
          final int r =
            status.getReduceSlotCapacity() - status.getOccupiedReduceSlots();
          if (m >= parts || r >= parts) {
            //favor ReduceSide machine
            final Machine value = r >= parts?
                ReduceSide.INSTANCE: MapSide.INSTANCE;
            Util.out.println("  " + this + " is " + value + " (m=" + m + ", r=" + r + ")");
View Full Code Here

   * We try to use some light-weight mechanism to determine cluster load.
   * @return Whether, from job client perspective, the cluster is overloaded.
   */
  private boolean isOverloaded(long now) throws IOException {
    try {
      ClusterMetrics clusterMetrics = jobTracker.getClusterMetrics();
     
      // If there are more jobs than number of task trackers, we assume the
      // cluster is overloaded. This is to bound the memory usage of the
      // simulator job tracker, in situations where we have jobs with small
      // number of map tasks and large number of reduce tasks.
      if (runningJobs.size() >= clusterMetrics.getTaskTrackerCount()) {
        System.out.printf("%d Overloaded is %s: " +
                "#runningJobs >= taskTrackerCount (%d >= %d)\n",
                now, Boolean.TRUE.toString(),
                runningJobs.size(), clusterMetrics.getTaskTrackerCount());
        return true;   
      }

      float incompleteMapTasks = 0; // include pending & running map tasks.
      for (Map.Entry<JobID, JobSketchInfo> entry : runningJobs.entrySet()) {
        org.apache.hadoop.mapreduce.JobStatus jobStatus = jobTracker
            .getJobStatus(entry.getKey());
        incompleteMapTasks += (1 - Math.min(jobStatus.getMapProgress(), 1.0))
            * entry.getValue().numMaps;
      }

      boolean overloaded = incompleteMapTasks >
          OVERLAOD_MAPTASK_MAPSLOT_RATIO * clusterMetrics.getMapSlotCapacity();
      String relOp = (overloaded) ? ">" : "<=";
      System.out.printf("%d Overloaded is %s: "
          + "incompleteMapTasks %s %.1f*mapSlotCapacity (%.1f %s %.1f*%d)\n",
          now, Boolean.toString(overloaded), relOp, OVERLAOD_MAPTASK_MAPSLOT_RATIO,
          incompleteMapTasks, relOp, OVERLAOD_MAPTASK_MAPSLOT_RATIO,
          clusterMetrics.getMapSlotCapacity());
      return overloaded;
    } catch (InterruptedException e) {
      throw new IOException("InterruptedException", e);
    }
  }
View Full Code Here

   *         of {@link ClusterStatus}.
   * @throws IOException
   */
  public ClusterStatus getClusterStatus() throws IOException {
    try {
      ClusterMetrics metrics = cluster.getClusterStatus();
      return new ClusterStatus(metrics.getTaskTrackerCount(),
        metrics.getBlackListedTaskTrackerCount(), cluster.getTaskTrackerExpiryInterval(),
        metrics.getOccupiedMapSlots(),
        metrics.getOccupiedReduceSlots(), metrics.getMapSlotCapacity(),
        metrics.getReduceSlotCapacity(),
        JobTracker.State.valueOf(cluster.getJobTrackerState().name()),
        metrics.getDecommissionedTaskTrackerCount());
    } catch (InterruptedException ie) {
      throw new IOException(ie);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.mapreduce.ClusterMetrics

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.