I'm trying to use YARN node labels to tag worker nodes, but when I run applications on YARN (Spark or simple YARN app), those applications cannot start.
with Spark, when specifying
--conf spark.yarn.am.nodeLabelExpression="my-label"
, the job cannot start (blocked onSubmitted application [...]
, see details below).with a YARN application (like
distributedshell
), when specifying-node_label_expression my-label
, the application cannot start neither
Here are the tests I have made so far.
YARN node labels setup
I'm using Google Dataproc to run my cluster (example : 4 workers, 2 on preemptible nodes). My goal is to force any YARN application master to run on a non-preemptible node, otherwise the node can be shutdown at any time, thus making the application fail hard.
I'm creating the cluster using YARN properties (--properties
) to enable node labels :
gcloud dataproc clusters create \
my-dataproc-cluster \
--project [PROJECT_ID] \
--zone [ZONE] \
--master-machine-type n1-standard-1 \
--master-boot-disk-size 10 \
--num-workers 2 \
--worker-machine-type n1-standard-1 \
--worker-boot-disk-size 10 \
--num-preemptible-workers 2 \
--properties 'yarn:yarn.node-labels.enabled=true,yarn:yarn.node-labels.fs-store.root-dir=/system/yarn/node-labels'
Versions of packaged Hadoop and Spark :
- Hadoop version : 2.8.2
- Spark version : 2.2.0
After that, I create a label (my-label
), and update the two non-preemptible workers with this label :
yarn rmadmin -addToClusterNodeLabels "my-label(exclusive=false)"
yarn rmadmin -replaceLabelsOnNode "\
[WORKER_0_NAME].c.[PROJECT_ID].internal=my-label \
[WORKER_1_NAME].c.[PROJECT_ID].internal=my-label"
I can see the created label in YARN Web UI :
Spark
When I run a simple example (SparkPi
) without specifying info about node labels :
spark-submit \
--class org.apache.spark.examples.SparkPi \
--master yarn \
--deploy-mode client \
/usr/lib/spark/examples/jars/spark-examples.jar \
10
In the Scheduler tab on YARN Web UI, I see the application launched on <DEFAULT_PARTITION>.root.default
.
But when I run the job specifying spark.yarn.am.nodeLabelExpression
to set the location of the Spark application master :
spark-submit \
--class org.apache.spark.examples.SparkPi \
--master yarn \
--deploy-mode client \
--conf spark.yarn.am.nodeLabelExpression="my-label" \
/usr/lib/spark/examples/jars/spark-examples.jar \
10
The job is not launched. From YARN Web UI, I see :
- YarnApplicationState:
ACCEPTED: waiting for AM container to be allocated, launched and register with RM.
- Diagnostics:
Application is Activated, waiting for resources to be assigned for AM. Details : AM Partition = my-label ; Partition Resource = <memory:6144, vCores:2> ; Queue's Absolute capacity = 0.0 % ; Queue's Absolute used capacity = 0.0 % ; Queue's Absolute max capacity = 0.0 % ;
I suspect that the queue related to the label partition (not <DEFAULT_PARTITION
, the other one) does not have sufficient resources to run the job :
Here, Used Application Master Resources
is <memory:1024, vCores:1>
, but the Max Application Master Resources
is <memory:0, vCores:0>
. That explains why the application cannot start, but I can't figure out how to change this.
I tried to update different parameters, but without success :
yarn.scheduler.capacity.root.default.accessible-node-labels=my-label
Or increasing those properties :
yarn.scheduler.capacity.root.default.accessible-node-labels.my-label.capacity
yarn.scheduler.capacity.root.default.accessible-node-labels.my-label.maximum-capacity
yarn.scheduler.capacity.root.default.accessible-node-labels.my-label.maximum-am-resource-percent
yarn.scheduler.capacity.root.default.accessible-node-labels.my-label.user-limit-factor
yarn.scheduler.capacity.root.default.accessible-node-labels.my-label.minimum-user-limit-percent
without success neither.
YARN Application
The issue is the same when running a YARN application :
hadoop jar \
/usr/lib/hadoop-yarn/hadoop-yarn-applications-distributedshell.jar \
-shell_command "echo ok" \
-jar /usr/lib/hadoop-yarn/hadoop-yarn-applications-distributedshell.jar \
-queue default \
-node_label_expression my-label
The application cannot start, and the logs keeps repeating :
INFO distributedshell.Client: Got application report from ASM for, appId=6, clientToAMToken=null, appDiagnostics= Application is Activated, waiting for resources to be assigned for AM. Details : AM Partition = my-label ; Partition Resource = <memory:6144, vCores:2> ; Queue's Absolute capacity = 0.0 % ; Queue's Absolute used capacity = 0.0 % ; Queue's Absolute max capacity = 0.0 % ; , appMasterHost=N/A, appQueue=default, appMasterRpcPort=-1, appStartTime=1520354045946, yarnAppState=ACCEPTED, distributedFinalState=UNDEFINED, [...]
If I don't specify -node_label_expression my-label
, the application start on <DEFAULT_PARTITION>.root.default
and succeed.
Questions
- Am I doing something wrong with the labels? However, I followed the official documentation and this guide
- Is this a specific problem related to Dataproc? Because the previous guides seems to work on other environments
- Maybe I need to create a specific queue and associate it with my label? But since I'm running a "one-shot" cluster to run a single Spark job I don't need to have specific queues, running jobs on the default root one is not a problem for my use-case
Thanks for helping