Example #1
0
  /** @param jobId Job id. */
  public void jobFinished(GridHadoopJobId jobId) {
    GridHadoopShuffleJob job = jobs.remove(jobId);

    if (job != null) {
      try {
        job.close();
      } catch (GridException e) {
        U.error(log, "Failed to close job: " + jobId, e);
      }
    }
  }
Example #2
0
  /**
   * Stops shuffle.
   *
   * @param cancel If should cancel all ongoing activities.
   */
  @Override
  public void stop(boolean cancel) {
    for (GridHadoopShuffleJob job : jobs.values()) {
      try {
        job.close();
      } catch (GridException e) {
        U.error(log, "Failed to close job.", e);
      }
    }

    jobs.clear();
  }
Example #3
0
  /**
   * @param jobId Task info.
   * @return Shuffle job.
   */
  private GridHadoopShuffleJob<UUID> job(GridHadoopJobId jobId) throws GridException {
    GridHadoopShuffleJob<UUID> res = jobs.get(jobId);

    if (res == null) {
      res = newJob(jobId);

      GridHadoopShuffleJob<UUID> old = jobs.putIfAbsent(jobId, res);

      if (old != null) {
        res.close();

        res = old;
      } else if (res.reducersInitialized()) startSending(res);
    }

    return res;
  }