ResourceManger UI
The ResourceManager UI displays the node labels on the Nodes page, and also on the Scheduler page.
Setting Node Labels when Submitting Jobs
You can specify a label (using the -node_label_expression
parameter) and a queue when you submit YARN jobs using the distributed shell client. If the queue has a label that satisfies the label expression, it will run the job on the labeled node(s). If the label expression does not reference a label associated with the specified queue, the job will not run and an error will be returned.
Note | |
---|---|
You can only specify one node label in the |
For example, the following commands run a simple YARN distributed shell "sleep for a long time" job. In this example we are asking for more containers than the cluster can run so we can see which node the job runs on. We are specifying that the job should run on queue "a1", which our user has permission to run jobs on. We are also using the -label_expression
parameter to specify that the job will run on all nodes with label "x".
sudo su yarn hadoop jar /usr/hdp/current/hadoop-yarn-client/hadoop-yarn-applications-distributedshell.jar -shell_command "sleep 100" -jar /usr/hdp/current/hadoop-yarn-client/hadoop-yarn-applications-distributedshell.jar -num_containers 30 -queue a1 -node_label_expression x
If we run this job on the example cluster we configured previously, containers are allocated on node-1, as this node has been assigned node label "x", and queue "a1" also has node label "x":
The following commands run the same job that we specifies node label "x", but this time we will specify queue "b1" rather than queue "a1".
sudo su yarn hadoop jar /usr/hdp/current/hadoop-yarn-client/hadoop-yarn-applications-distributedshell.jar -shell_command "sleep 100000" -jar /usr/hdp/current/hadoop-yarn-client/hadoop-yarn-applications-distributedshell.jar -num_containers 30 -queue b1 -node_label_expression x
When we attempt to run this job on our example cluster, the job will fail with the following error message because label "x" is not associated with queue "b1".
14/11/24 13:42:21 INFO distributedshell.Client: Submitting application to ASM 14/11/24 13:42:21 FATAL distributedshell.Client: Error running Client org.apache.hadoop.yarn.exceptions.InvalidResourceRequestException: Invalid resource request, queue=b1 doesn't have permission to access all labels in resource request. labelExpression of resource request=x. Queue labels=y
MapReduce Jobs and Node Labels
Currently you cannot specify a node label when submitting a MapReduce job. However, if you submit a MapReduce job to a queue that has a default node label expression, the default node label will be applied to the MapReduce job.
Using default node label expressions tends to constrain larger portions of the cluster, which at some point starts to become counter-productive for jobs -- such as MapReduce jobs -- that benefit from the advantages offered by distributed parallel processing.