This is a sample JSON structure of the proposed diagnostics resource -
API consumers will need to call SliderClient#actionDiagnosticContainers API to get the ApplicationDiagnostics object. This object has 3 attributes -
- finalStatus - app-level status which is empty for a running app (of type org.apache.hadoop.yarn.api.records.FinalApplicationStatus)
- finalMessage - app-level summary message which is populated after the app dies
- containers - a set of all currently running and all previously failed containers (type org.apache.slider.api.types.ContainerInformation)
Note, it also contains an additional helper method getContainer(String containerId) which will return the ContainerInformation for a specific container if the container-id is known.
ContainerInformation (for each running or dead container) contains several attributes which gets updated as and when a container transitions through various stages - like newly created, running, dead, etc. Following are the attributes -
- released (true/false)
- state (of type org.apache.slider.api.StateValues)
- exitCode (of type org.apache.hadoop.yarn.api.records.ContainerExitStatus)
- diagnostics (container level diagnostics message)
- output (empty so don't use)
- logLink (container log link for a live as well as a dead container)
ApplicationDiagnostics object can be retrieved at any point in the app's lifetime by calling the SliderClient#actionDiagnosticContainers(ActionDiagnosticArgs diagnosticArgs) API with only the name field in ActionDiagnosticArgs set to the application name. It can be retrieved on the command-line by calling the diagnostics command with the following arguments -
On the command-line it is dumped in JSON format.
The ApplicationDiagnostics object is set as YARN application diagnostics and can be retrieved by YARN API or through application command line like -
Note, the ApplicationDiagnostics object (in JSON format) can also be viewed in RM UI of the application in the Diagnostics: field.
To retrieve using YARN Client API, this JSON string can be retrieved by calling YarnClient#getApplicationReport(ApplicationId appId) to get the ApplicationReport and then subsequently calling ApplicationReport#getDiagnostics. This JSON string can then be easily converted to the Slider ApplicationDiagnostics object by calling the static method ApplicationDiagnostics#fromJson(String json).