Multiple state machine objects are implemented in yarn, including scheduler, rmapp-attemptimpl, scheduler, rmnodeimpl in ResourceManager, applicationimpl, scheduler, localizedresource in nodemanager, jobimpl, taskimpl, and scheduler in mrappmaster. Yarn provides a state machine visualization tool to help you view the state changes and related events of these state machines. The procedure is as follows.
Step 1. Convert the state machine to a file in graphviz (. gv) format and run the following command in the source code root directory:
MVN compile-pvisualize
After this step, three graphviz files, ResourceManager. gv, nodemanager. gv, and mapreduce. gv, are generated in the local directory. The content of the localizedresource state machine in the nodemanager. gv file is as follows:
subgraph cluster_LocalizedResource {label="LocalizedResource" "LocalizedResource.FAILED" [ label = FAILED ]; "LocalizedResource.DOWNLOADING" [ label = DOWNLOADING ]; "LocalizedResource.DOWNLOADING" -> "LocalizedResource.DOWNLOADING" [ label = "REQUEST,\nRELEASE" ]; "LocalizedResource.DOWNLOADING" -> "LocalizedResource.FAILED" [ label = "LOCALIZATION_FAILED" ]; "LocalizedResource.DOWNLOADING" -> "LocalizedResource.LOCALIZED" [ label = "LOCALIZED" ]; "LocalizedResource.INIT" [ label = INIT ]; "LocalizedResource.INIT" -> "LocalizedResource.DOWNLOADING" [ label = "REQUEST" ]; "LocalizedResource.LOCALIZED" [ label = LOCALIZED ]; "LocalizedResource.LOCALIZED" -> "LocalizedResource.LOCALIZED" [ label = "REQUEST,\nRELEASE" ];}
Step 2. Use the relevant commands in graphviz to generate a state machine diagram. The shell command is as follows:
Dot-tpng nodemanager. gv> nodemanager.png
If you have not installed the graphviz package, you must install the package before performing this step. The installation command of cent OS is as follows:
Sudo Yum install graphviz
Open nodemanager.png, as shown in (two charts are split for ease of display ):
Yarn state machine Visualization