Search in sources :

Example 6 with JobStateInternal

use of org.apache.hadoop.mapreduce.v2.app.job.JobStateInternal in project hadoop by apache.

the class MRApp method createJob.

@Override
protected Job createJob(Configuration conf, JobStateInternal forcedState, String diagnostic) {
    UserGroupInformation currentUser = null;
    try {
        currentUser = UserGroupInformation.getCurrentUser();
    } catch (IOException e) {
        throw new YarnRuntimeException(e);
    }
    Job newJob = new TestJob(getJobId(), getAttemptID(), conf, getDispatcher().getEventHandler(), getTaskAttemptListener(), getContext().getClock(), getCommitter(), isNewApiCommitter(), currentUser.getUserName(), getContext(), forcedState, diagnostic);
    ((AppContext) getContext()).getAllJobs().put(newJob.getID(), newJob);
    getDispatcher().register(JobFinishEvent.Type.class, new EventHandler<JobFinishEvent>() {

        @Override
        public void handle(JobFinishEvent event) {
            stop();
        }
    });
    return newJob;
}
Also used : YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) JobFinishEvent(org.apache.hadoop.mapreduce.v2.app.job.event.JobFinishEvent) IOException(java.io.IOException) Job(org.apache.hadoop.mapreduce.v2.app.job.Job) UserGroupInformation(org.apache.hadoop.security.UserGroupInformation)

Aggregations

JobStateInternal (org.apache.hadoop.mapreduce.v2.app.job.JobStateInternal)4 Job (org.apache.hadoop.mapreduce.v2.app.job.Job)2 JobEvent (org.apache.hadoop.mapreduce.v2.app.job.event.JobEvent)2 JobFinishEvent (org.apache.hadoop.mapreduce.v2.app.job.event.JobFinishEvent)2 YarnRuntimeException (org.apache.hadoop.yarn.exceptions.YarnRuntimeException)2 IOException (java.io.IOException)1 Configuration (org.apache.hadoop.conf.Configuration)1 Counters (org.apache.hadoop.mapreduce.Counters)1 JobID (org.apache.hadoop.mapreduce.JobID)1 JobTokenSecretManager (org.apache.hadoop.mapreduce.security.token.JobTokenSecretManager)1 TaskSplitMetaInfo (org.apache.hadoop.mapreduce.split.JobSplit.TaskSplitMetaInfo)1 JobId (org.apache.hadoop.mapreduce.v2.api.records.JobId)1 CommitterEventHandler (org.apache.hadoop.mapreduce.v2.app.commit.CommitterEventHandler)1 JobImpl (org.apache.hadoop.mapreduce.v2.app.job.impl.JobImpl)1 InitTransition (org.apache.hadoop.mapreduce.v2.app.job.impl.JobImpl.InitTransition)1 MRAppMetrics (org.apache.hadoop.mapreduce.v2.app.metrics.MRAppMetrics)1 Credentials (org.apache.hadoop.security.Credentials)1 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)1 EventHandler (org.apache.hadoop.yarn.event.EventHandler)1 InvalidStateTransitionException (org.apache.hadoop.yarn.state.InvalidStateTransitionException)1