Exemple #1
0
 /** Create and initialize (but don't start) a single job. */
 protected Job createJob(Configuration conf) {
   // create single job
   Job newJob = new JobInAppMaster(jobId, conf, context);
   ((RunningAppContext) context).jobs.put(newJob.getID(), newJob);
   dispatcher.register(JobFinishEvent.Type.class, createJobFinishEventHandler());
   return newJob;
 }
Exemple #2
0
 @SuppressWarnings("unchecked")
 @Override
 public void handle(TaskAttemptEvent event) {
   Job job = context.getJob(event.getTaskAttemptID().getTaskId().getJobId());
   Task task = job.getTask(event.getTaskAttemptID().getTaskId());
   TaskAttempt attempt = task.getAttempt(event.getTaskAttemptID());
   ((EventHandler<TaskAttemptEvent>) attempt).handle(event);
 }
Exemple #3
0
 /**
  * This can be overridden to instantiate multiple jobs and create a workflow.
  *
  * <p>TODO: Rework the design to actually support this. Currently much of the job stuff has been
  * moved to init() above to support uberization (MR-1220). In a typical workflow, one presumably
  * would want to uberize only a subset of the jobs (the "small" ones), which is awkward with the
  * current design.
  */
 @SuppressWarnings("unchecked")
 protected void startJobs() {
   /** create a job-start event to get this ball rolling */
   JobEvent startJobEvent = new JobEvent(job.getID(), JobEventType.JOB_START);
   /** send the job-start event. this triggers the job execution. */
   context.getEventHandler().handle(startJobEvent);
 }
Exemple #4
0
  @Override
  public void start() {
    // / Create the AMInfo for the current AppMaster
    if (amInfos == null) {
      amInfos = new LinkedList<AMInfo>();
    }
    AMInfo amInfo =
        DragonBuilderUtils.newAMInfo(
            appAttemptId, startTime, containerID, nmHost, nmPort, nmHttpPort);
    amInfos.add(amInfo);

    job = createJob(getConfig());

    // metrics system init is really init & start.
    // It's more test friendly to put it here.
    DefaultMetricsSystem.initialize("DragonAppMaster");

    // create a job event for job intialization
    JobEvent initJobEvent = new JobEvent(job.getID(), JobEventType.JOB_INIT);
    // Send init to the job (this does NOT trigger job execution)
    // This is a synchronous call, not an event through dispatcher. We want
    // job-init to be done completely here.
    jobEventDispatcher.handle(initJobEvent);

    super.start();

    // All components have started, start the job.
    startJobs();
  }