Esempio n. 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;
 }
  private void startDAG(DAG dag) {
    currentDAG = dag;
    this.state = DAGAppMasterState.RUNNING;

    // End of creating the job.
    ((RunningAppContext) context).setDAG(currentDAG);

    // create a job event for job initialization
    DAGEvent initDagEvent = new DAGEvent(currentDAG.getID(), DAGEventType.DAG_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.
    dagEventDispatcher.handle(initDagEvent);

    // All components have started, start the job.
    /** create a job-start event to get this ball rolling */
    DAGEvent startDagEvent = new DAGEvent(currentDAG.getID(), DAGEventType.DAG_START);
    /** send the job-start event. this triggers the job execution. */
    sendEvent(startDagEvent);
  }