Esempio n. 1
0
  /**
   * Get the percentage of jobs in the job group owning the given job which are currently Running,
   * Limbo or Finished.
   */
  public double percentEngaged(TaskTimer timer, long jobID) {
    Counters counters = null;
    timer.acquire();
    synchronized (pCountersByJob) {
      timer.resume();
      counters = pCountersByJob.get(jobID);
    }

    if (counters != null) {
      double percent = counters.percentEngaged();

      //       if(LogMgr.getInstance().isLoggable(LogMgr.Kind.Ops, LogMgr.Level.Finest))
      //         LogMgr.getInstance().log
      //           (LogMgr.Kind.Ops, LogMgr.Level.Finest,
      //            "Percent Engaged [" + jobID + "]: " + String.format("%1$.4f", percent));

      return percent;
    } else {
      LogMgr.getInstance()
          .logAndFlush(
              LogMgr.Kind.Ops,
              LogMgr.Level.Warning,
              "Somehow the job (" + jobID + ") was not in the state counts table!");
      return 0.0;
    }
  }