Complete the code to import the YARN ResourceManager client.
from yarn_api_client import [1]
The ResourceManager class is used to interact with YARN's resource management.
Complete the code to initialize the ResourceManager client with the correct URL.
rm = ResourceManager('http://[1]:8088/ws/v1/cluster')
The ResourceManager URL typically uses the hostname where YARN ResourceManager runs, often 'yarn-resourcemanager'.
Fix the error in the code to get cluster metrics from YARN.
metrics = rm.[1]()The correct method to get cluster metrics is get_cluster_metrics().
Fill both blanks to create a dictionary comprehension that maps node IDs to their states.
node_states = {node['[1]']: node['[2]'] for node in nodes}Each node dictionary has 'nodeId' and 'state' keys to identify and describe its status.
Fill all three blanks to filter nodes that are RUNNING and create a list of their IDs.
running_nodes = [node['[1]'] for node in nodes if node['[2]'] == '[3]']
We filter nodes where 'state' equals 'RUNNING' and collect their 'nodeId's.