Package org.apache.hadoop.tools.rumen

Examples of org.apache.hadoop.tools.rumen.JobStory


    this(jobTracker, jobStoryProducer,  SimulatorJobSubmissionPolicy.REPLAY);
  }

  @Override
  public List<SimulatorEvent> init(long when) throws IOException {
    JobStory job = jobStoryProducer.getNextJob();
    if (submissionPolicy == SimulatorJobSubmissionPolicy.REPLAY
        && job.getSubmissionTime() != when) {
      throw new IOException("Inconsistent submission time for the first job: "
          + when + " != " + job.getSubmissionTime()+".");
    }
   
    JobSubmissionEvent event = new JobSubmissionEvent(this, when, job);
    if (submissionPolicy != SimulatorJobSubmissionPolicy.STRESS) {
      return Collections.<SimulatorEvent> singletonList(event);
View Full Code Here


   */
  private List<SimulatorEvent> processJobSubmissionEvent(
      JobSubmissionEvent submitEvent) throws IOException {
    // Submit job
    JobStatus status = null;
    JobStory story = submitEvent.getJob();
    try {
      status = submitJob(story);
    } catch (InterruptedException e) {
      throw new IOException(e);
    }
    runningJobs.put(status.getJobID(), new JobSketchInfo(story.getNumberMaps(),
        story.getNumberReduces()));
    System.out.println("Job " + status.getJobID() + " is submitted at "
        + submitEvent.getTimeStamp());

    // Find the next job to submit
    nextJob = jobStoryProducer.getNextJob();
View Full Code Here

    }

    if (!noMoreJobs) {
      if (submissionPolicy == SimulatorJobSubmissionPolicy.SERIAL) {
        long submissionTime = jobCompleteEvent.getTimeStamp() + 1;
        JobStory story = new SimulatorJobStory(nextJob, submissionTime);
        return Collections
            .<SimulatorEvent> singletonList(new JobSubmissionEvent(this,
                submissionTime, story));
      } else if (submissionPolicy == SimulatorJobSubmissionPolicy.STRESS) {
        return checkLoadAndSubmitJob(jobCompleteEvent.getTimeStamp());
View Full Code Here

      ret.add(inFlightLPE);
    }

    if (!overloaded) {
      long submissionTime = now + 1;
      JobStory story = new SimulatorJobStory(nextJob, submissionTime);
      ret.add(new JobSubmissionEvent(this, submissionTime, story));
    }
   
    return ret;
  }
View Full Code Here

    }
  }

  @Override
  public JobStory getNextJob() throws IOException {
    JobStory job = getNextJobFiltered();
    if (job == null)
      return null;
    if (firstJob) {
      firstJob = false;
      relativeTime = job.getSubmissionTime() - firstJobStartTime;
    }

    return new SimulatorJobStory(job, job.getSubmissionTime() - relativeTime);
  }
View Full Code Here

              }
            }

            while (!loadStatus.overloaded()) {
              try {
                final JobStory job = getNextJobFiltered();
                if (null == job) {
                  return;
                }
                submitter.add(
                  jobCreator.createGridmixJob(
                    conf, 0L, job, scratch,
                    userResolver.getTargetUgi(
                      UserGroupInformation.createRemoteUser(job.getUser())),
                    sequence.getAndIncrement()));
                // TODO: We need to take care of scenario when one map/reduce
                // takes more than 1 slot.
                loadStatus.mapSlotsBackfill -=
                  calcEffectiveIncompleteMapTasks(
                    loadStatus.mapSlotCapacity, job.getNumberMaps(), 0.0f);
                loadStatus.reduceSlotsBackfill -=
                  calcEffectiveIncompleteReduceTasks(
                    loadStatus.reduceSlotCapacity, job.getNumberReduces(),
                    0.0f);
                --loadStatus.numJobsBackfill;
              } catch (IOException e) {
                LOG.error("Error while submitting the job ", e);
                error = e;
View Full Code Here

  }

  protected abstract Thread createReaderThread() ;

  protected JobStory getNextJobFiltered() throws IOException {
    JobStory job;
    do {
      job = jobProducer.getNextJob();
    } while (job != null &&
      (job.getOutcome() != Pre21JobHistoryConstants.Values.SUCCESS ||
        job.getSubmissionTime() < 0));
    return null == job ? null : new FilterJobStory(job) {
      @Override
      public TaskInfo getTaskInfo(TaskType taskType, int taskNumber) {
        return new MinTaskInfo(this.job.getTaskInfo(taskType, taskNumber));
      }
View Full Code Here

  @Override
  void buildSplits(FilePool inputDir) throws IOException {
    long mapInputBytesTotal = 0L;
    long mapOutputBytesTotal = 0L;
    long mapOutputRecordsTotal = 0L;
    final JobStory jobdesc = getJobDesc();
    if (null == jobdesc) {
      return;
    }
    final int maps = jobdesc.getNumberMaps();
    final int reds = jobdesc.getNumberReduces();
    for (int i = 0; i < maps; ++i) {
      final TaskInfo info = jobdesc.getTaskInfo(TaskType.MAP, i);
      mapInputBytesTotal += info.getInputBytes();
      mapOutputBytesTotal += info.getOutputBytes();
      mapOutputRecordsTotal += info.getOutputRecords();
    }
    final double[] reduceRecordRatio = new double[reds];
    final double[] reduceByteRatio = new double[reds];
    for (int i = 0; i < reds; ++i) {
      final TaskInfo info = jobdesc.getTaskInfo(TaskType.REDUCE, i);
      reduceByteRatio[i] = info.getInputBytes() / (1.0 * mapOutputBytesTotal);
      reduceRecordRatio[i] =
        info.getInputRecords() / (1.0 * mapOutputRecordsTotal);
    }
    final InputStriper striper = new InputStriper(inputDir, mapInputBytesTotal);
    final List<InputSplit> splits = new ArrayList<InputSplit>();
    for (int i = 0; i < maps; ++i) {
      final int nSpec = reds / maps + ((reds % maps) > i ? 1 : 0);
      final long[] specBytes = new long[nSpec];
      final long[] specRecords = new long[nSpec];
      for (int j = 0; j < nSpec; ++j) {
        final TaskInfo info =
          jobdesc.getTaskInfo(TaskType.REDUCE, i + j * maps);
        specBytes[j] = info.getOutputBytes();
        specRecords[j] = info.getOutputRecords();
        if (LOG.isDebugEnabled()) {
          LOG.debug(String.format("SPEC(%d) %d -> %d %d %d", id(), i,
                    i + j * maps, info.getOutputRecords(),
                    info.getOutputBytes()));
        }
      }
      final TaskInfo info = jobdesc.getTaskInfo(TaskType.MAP, i);
      splits.add(
        new LoadSplit(striper.splitFor(inputDir, info.getInputBytes(), 3),
                      maps, i, info.getInputBytes(), info.getInputRecords(),
                      info.getOutputBytes(), info.getOutputRecords(),
                      reduceByteRatio, reduceRecordRatio, specBytes,
View Full Code Here

        LOG.info("START REPLAY @ " + initTime);
        long first = -1;
        long last = -1;
        while (!Thread.currentThread().isInterrupted()) {
          try {
            final JobStory job = getNextJobFiltered();
            if (null == job) {
              return;
            }
            if (first < 0) {
              first = job.getSubmissionTime();
            }
            final long current = job.getSubmissionTime();
            if (current < last) {
              LOG.warn("Job " + job.getJobID() + " out of order");
              continue;
            }
            last = current;
            submitter.add(
              jobCreator.createGridmixJob(
                conf, initTime + Math.round(rateFactor * (current - first)),
                job, scratch,
                userResolver.getTargetUgi(
                  UserGroupInformation.createRemoteUser(job.getUser())),
                sequence.getAndIncrement()));
          } catch (IOException e) {
            error = e;
            return;
          }
View Full Code Here

          return;
        }
        LOG.info("START SERIAL @ " + System.currentTimeMillis());
        GridmixJob prevJob;
        while (!Thread.currentThread().isInterrupted()) {
          final JobStory job;
          try {
            job = getNextJobFiltered();
            if (null == job) {
              return;
            }
            if (LOG.isDebugEnabled()) {
              LOG.debug(
                "Serial mode submitting job " + job.getName());
            }
            prevJob = jobCreator.createGridmixJob(
              conf, 0L, job, scratch,
              userResolver.getTargetUgi(
                UserGroupInformation.createRemoteUser(job.getUser())),
              sequence.getAndIncrement());

            lock.lock();
            try {
              LOG.info(" Submitted the job " + prevJob);
              submitter.add(prevJob);
            } finally {
              lock.unlock();
            }
          } catch (IOException e) {
            error = e;
            //If submission of current job fails , try to submit the next job.
            return;
          }

          if (prevJob != null) {
            //Wait till previous job submitted is completed.
            lock.lock();
            try {
              while (true) {
                try {
                  jobCompleted.await();
                } catch (InterruptedException ie) {
                  LOG.error(
                    " Error in SerialJobFactory while waiting for job completion ",
                    ie);
                  return;
                }
                if (LOG.isDebugEnabled()) {
                  LOG.info(" job " + job.getName() + " completed ");
                }
                break;
              }
            } finally {
              lock.unlock();
View Full Code Here

TOP

Related Classes of org.apache.hadoop.tools.rumen.JobStory

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.