Class JobImpl
java.lang.Object
org.apache.hadoop.mapreduce.v2.app.job.impl.JobImpl
public class JobImpl
extends Object
implements Job, org.apache.hadoop.yarn.event.EventHandler<JobEvent>
Implementation of Job interface. Maintains the state machines of Job.
The read and write calls use ReadWriteLock for concurrency.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionorg.apache.hadoop.mapred.JobConfstatic final Stringorg.apache.hadoop.fs.Pathprotected static final org.apache.hadoop.yarn.state.StateMachineFactory<JobImpl,JobStateInternal, JobEventType, JobEvent> -
Constructor Summary
ConstructorsConstructorDescriptionJobImpl(org.apache.hadoop.mapreduce.v2.api.records.JobId jobId, org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.yarn.event.EventHandler eventHandler, TaskAttemptListener taskAttemptListener, org.apache.hadoop.mapreduce.security.token.JobTokenSecretManager jobTokenSecretManager, org.apache.hadoop.security.Credentials jobCredentials, org.apache.hadoop.yarn.util.Clock clock, Map<org.apache.hadoop.mapreduce.v2.api.records.TaskId, org.apache.hadoop.mapreduce.jobhistory.JobHistoryParser.TaskInfo> completedTasksFromPreviousRun, MRAppMetrics metrics, org.apache.hadoop.mapreduce.OutputCommitter committer, boolean newApiCommitter, String userName, long appSubmitTime, List<org.apache.hadoop.mapreduce.v2.api.records.AMInfo> amInfos, AppContext appContext, JobStateInternal forcedState, String forcedDiagnostic) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddDiagnostic(String diag) protected voidbooleancheckAccess(org.apache.hadoop.security.UserGroupInformation callerUGI, org.apache.hadoop.mapreduce.JobACL jobOperation) protected JobStateInternalvoidstatic StringescapeString(String data) org.apache.hadoop.mapreduce.CountersGet all the counters of this job.List<org.apache.hadoop.mapreduce.v2.api.records.AMInfo>intintorg.apache.hadoop.fs.Pathintintprotected org.apache.hadoop.fs.FileSystemgetFileSystem(org.apache.hadoop.conf.Configuration conf) Create the default file System for this job.org.apache.hadoop.mapreduce.v2.api.records.JobIdgetID()Map<org.apache.hadoop.mapreduce.JobACL,org.apache.hadoop.security.authorize.AccessControlList> intintorg.apache.hadoop.mapred.TaskCompletionEvent[]getMapAttemptCompletionEvents(int startIndex, int maxEvents) floatintgetName()floatorg.apache.hadoop.mapreduce.v2.api.records.JobReportorg.apache.hadoop.mapreduce.v2.api.records.JobStategetState()protected org.apache.hadoop.yarn.state.StateMachine<JobStateInternal,JobEventType, JobEvent> getTask(org.apache.hadoop.mapreduce.v2.api.records.TaskId taskID) org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptCompletionEvent[]getTaskAttemptCompletionEvents(int fromEventId, int maxEvents) getTasks()getTasks(org.apache.hadoop.mapreduce.v2.api.records.TaskType taskType) intintvoidstatic org.apache.hadoop.mapreduce.CountersincrTaskCounters(org.apache.hadoop.mapreduce.Counters counters, Collection<Task> tasks) booleanisUber()org.apache.hadoop.conf.Configurationprotected voidscheduleTasks(Set<org.apache.hadoop.mapreduce.v2.api.records.TaskId> taskIDs, boolean recoverTaskOutput) voidsetJobPriority(org.apache.hadoop.yarn.api.records.Priority priority) voidsetQueueName(String queueName)
-
Field Details
-
JOB_KILLED_DIAG
- See Also:
-
conf
public org.apache.hadoop.mapred.JobConf conf -
remoteJobConfFile
public org.apache.hadoop.fs.Path remoteJobConfFile -
stateMachineFactory
protected static final org.apache.hadoop.yarn.state.StateMachineFactory<JobImpl,JobStateInternal, stateMachineFactoryJobEventType, JobEvent>
-
-
Constructor Details
-
JobImpl
public JobImpl(org.apache.hadoop.mapreduce.v2.api.records.JobId jobId, org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.yarn.event.EventHandler eventHandler, TaskAttemptListener taskAttemptListener, org.apache.hadoop.mapreduce.security.token.JobTokenSecretManager jobTokenSecretManager, org.apache.hadoop.security.Credentials jobCredentials, org.apache.hadoop.yarn.util.Clock clock, Map<org.apache.hadoop.mapreduce.v2.api.records.TaskId, org.apache.hadoop.mapreduce.jobhistory.JobHistoryParser.TaskInfo> completedTasksFromPreviousRun, MRAppMetrics metrics, org.apache.hadoop.mapreduce.OutputCommitter committer, boolean newApiCommitter, String userName, long appSubmitTime, List<org.apache.hadoop.mapreduce.v2.api.records.AMInfo> amInfos, AppContext appContext, JobStateInternal forcedState, String forcedDiagnostic)
-
-
Method Details
-
getStateMachine
protected org.apache.hadoop.yarn.state.StateMachine<JobStateInternal,JobEventType, getStateMachine()JobEvent> -
getID
public org.apache.hadoop.mapreduce.v2.api.records.JobId getID() -
checkAccess
public boolean checkAccess(org.apache.hadoop.security.UserGroupInformation callerUGI, org.apache.hadoop.mapreduce.JobACL jobOperation) - Specified by:
checkAccessin interfaceJob
-
getTask
-
getCompletedMaps
public int getCompletedMaps()- Specified by:
getCompletedMapsin interfaceJob
-
getCompletedReduces
public int getCompletedReduces()- Specified by:
getCompletedReducesin interfaceJob
-
isUber
public boolean isUber() -
getAllCounters
public org.apache.hadoop.mapreduce.Counters getAllCounters()Description copied from interface:JobGet all the counters of this job. This includes job-counters aggregated together with the counters of each task. This creates a clone of the Counters, so use this judiciously.- Specified by:
getAllCountersin interfaceJob- Returns:
- job-counters and aggregate task-counters
-
incrTaskCounters
public static org.apache.hadoop.mapreduce.Counters incrTaskCounters(org.apache.hadoop.mapreduce.Counters counters, Collection<Task> tasks) -
getTaskAttemptCompletionEvents
public org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptCompletionEvent[] getTaskAttemptCompletionEvents(int fromEventId, int maxEvents) - Specified by:
getTaskAttemptCompletionEventsin interfaceJob
-
getMapAttemptCompletionEvents
public org.apache.hadoop.mapred.TaskCompletionEvent[] getMapAttemptCompletionEvents(int startIndex, int maxEvents) - Specified by:
getMapAttemptCompletionEventsin interfaceJob
-
getDiagnostics
- Specified by:
getDiagnosticsin interfaceJob
-
getReport
public org.apache.hadoop.mapreduce.v2.api.records.JobReport getReport() -
getProgress
public float getProgress()- Specified by:
getProgressin interfaceJob
-
getTasks
-
getTasks
-
getState
public org.apache.hadoop.mapreduce.v2.api.records.JobState getState() -
scheduleTasks
protected void scheduleTasks(Set<org.apache.hadoop.mapreduce.v2.api.records.TaskId> taskIDs, boolean recoverTaskOutput) -
handle
- Specified by:
handlein interfaceorg.apache.hadoop.yarn.event.EventHandler<JobEvent>
-
getInternalState
-
addTask
-
getFileSystem
protected org.apache.hadoop.fs.FileSystem getFileSystem(org.apache.hadoop.conf.Configuration conf) throws IOException Create the default file System for this job.- Parameters:
conf- the conf object- Returns:
- the default filesystem for this job
- Throws:
IOException
-
checkReadyForCommit
-
getUserName
- Specified by:
getUserNamein interfaceJob
-
getQueueName
- Specified by:
getQueueNamein interfaceJob
-
setQueueName
- Specified by:
setQueueNamein interfaceJob
-
getConfFile
public org.apache.hadoop.fs.Path getConfFile()- Specified by:
getConfFilein interfaceJob- Returns:
- a path to where the config file for this job is located.
-
getName
-
getTotalMaps
public int getTotalMaps()- Specified by:
getTotalMapsin interfaceJob
-
getTotalReduces
public int getTotalReduces()- Specified by:
getTotalReducesin interfaceJob
-
getJobACLs
public Map<org.apache.hadoop.mapreduce.JobACL,org.apache.hadoop.security.authorize.AccessControlList> getJobACLs()- Specified by:
getJobACLsin interfaceJob- Returns:
- the ACLs for this job for each type of JobACL given.
-
getAMInfos
- Specified by:
getAMInfosin interfaceJob- Returns:
- information for MR AppMasters (previously failed and current)
-
escapeString
-
constructFinalFullcounters
@Private public void constructFinalFullcounters() -
addDiagnostic
-
loadConfFile
- Specified by:
loadConfFilein interfaceJob- Returns:
- a parsed version of the config files pointed to by
Job.getConfFile(). - Throws:
IOException- on any error trying to load the conf file.
-
getMaxAllowedFetchFailuresFraction
public float getMaxAllowedFetchFailuresFraction() -
getMaxFetchFailuresNotifications
public int getMaxFetchFailuresNotifications() -
setJobPriority
public void setJobPriority(org.apache.hadoop.yarn.api.records.Priority priority) - Specified by:
setJobPriorityin interfaceJob
-
getFailedMaps
public int getFailedMaps()- Specified by:
getFailedMapsin interfaceJob
-
getFailedReduces
public int getFailedReduces()- Specified by:
getFailedReducesin interfaceJob
-
getKilledMaps
public int getKilledMaps()- Specified by:
getKilledMapsin interfaceJob
-
getKilledReduces
public int getKilledReduces()- Specified by:
getKilledReducesin interfaceJob
-