0
0
Hadoopdata~10 mins

Application lifecycle in YARN in Hadoop - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Application lifecycle in YARN
Client submits application
ResourceManager receives request
ResourceManager allocates ApplicationMaster container
ApplicationMaster starts and registers with ResourceManager
ApplicationMaster requests resources for tasks
ResourceManager allocates containers
ApplicationMaster launches tasks in containers
Tasks run and report progress
ApplicationMaster monitors tasks
On completion, ApplicationMaster unregisters
ResourceManager cleans up application
Application ends
This flow shows how a YARN application moves from submission to completion through ResourceManager and ApplicationMaster coordination.
Execution Sample
Hadoop
1. Client submits application to ResourceManager
2. ResourceManager allocates ApplicationMaster container
3. ApplicationMaster registers and requests task containers
4. ResourceManager allocates containers
5. ApplicationMaster launches tasks
6. Tasks run and report progress
7. ApplicationMaster unregisters on completion
This sequence shows the main steps in the YARN application lifecycle from submission to completion.
Execution Table
StepComponentActionResultNext Step
1ClientSubmit applicationApplication request sent to ResourceManagerResourceManager receives request
2ResourceManagerAllocate ApplicationMaster containerContainer allocated for ApplicationMasterApplicationMaster starts
3ApplicationMasterRegister with ResourceManagerRegistration successfulRequest task containers
4ApplicationMasterRequest containers for tasksResourceManager receives requestsResourceManager allocates containers
5ResourceManagerAllocate containers for tasksContainers allocatedApplicationMaster launches tasks
6ApplicationMasterLaunch tasks in containersTasks startedTasks run and report progress
7TasksRun and report progressProgress updates sentApplicationMaster monitors tasks
8ApplicationMasterMonitor tasksTasks completeUnregister from ResourceManager
9ApplicationMasterUnregister from ResourceManagerUnregistration successfulResourceManager cleans up
10ResourceManagerClean up applicationResources freedApplication ends
11-Application endsApplication lifecycle complete-
💡 Application ends after ResourceManager cleans up resources and ApplicationMaster unregisters.
Variable Tracker
VariableStartAfter Step 2After Step 5After Step 8Final
Application StateNot submittedAM container allocatedTasks launchedTasks completedApplication ended
ResourceManager StateIdleAM container allocatedTask containers allocatedMonitoring tasksCleaning up
ApplicationMaster StateNot startedStartedLaunching tasksMonitoring tasksUnregistered
Key Moments - 3 Insights
Why does the ApplicationMaster need to register with the ResourceManager?
The ApplicationMaster registers to inform the ResourceManager it is ready to manage the application. This is shown in step 3 of the execution_table where registration enables resource requests.
What happens if the ResourceManager does not allocate containers for tasks?
Without container allocation (step 5), the ApplicationMaster cannot launch tasks, so the application cannot proceed. This blocks progress until containers are allocated.
Why does the ApplicationMaster unregister at the end?
Unregistering (step 9) signals the ResourceManager that the application is complete and resources can be freed, as shown in the cleanup step 10.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the ApplicationMaster state after step 3?
AStarted and registered
BNot started
CUnregistered
DTasks launched
💡 Hint
Check the execution_table rows for steps 2 and 3.
At which step does the ResourceManager allocate containers for tasks?
AStep 4
BStep 5
CStep 2
DStep 7
💡 Hint
Look at the execution_table row where ResourceManager allocates containers.
If the ApplicationMaster does not unregister, what is the likely impact?
AResourceManager cleans up resources anyway
BTasks restart automatically
CApplication remains active and resources are not freed
DClient resubmits application
💡 Hint
Refer to key_moments explanation about unregistering and resource cleanup.
Concept Snapshot
YARN Application Lifecycle:
1. Client submits application to ResourceManager.
2. ResourceManager allocates ApplicationMaster container.
3. ApplicationMaster registers and requests task containers.
4. ResourceManager allocates containers.
5. ApplicationMaster launches tasks.
6. Tasks run and report progress.
7. ApplicationMaster unregisters and ResourceManager cleans up.
Key: ApplicationMaster manages tasks and communicates with ResourceManager.
Full Transcript
The YARN application lifecycle starts when the client submits an application to the ResourceManager. The ResourceManager allocates a container for the ApplicationMaster, which then registers itself with the ResourceManager. The ApplicationMaster requests containers for running tasks. The ResourceManager allocates these containers, and the ApplicationMaster launches the tasks inside them. Tasks run and report progress back to the ApplicationMaster, which monitors them. When all tasks complete, the ApplicationMaster unregisters from the ResourceManager. Finally, the ResourceManager cleans up resources, ending the application lifecycle.