-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rely on bash default value interpolation #7182
Open
xyu
wants to merge
1
commit into
apache:trunk
Choose a base branch
from
xyu:patch-1
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+3
−5
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The `whitelistedEnv()` function writes a bash export for the environment using a default value syntax, e.g.: ``` export MY_VAR=${MY_VAR:-"value sent in NM env"} ``` Which makes checking if `MY_VAR` exists in the environment passed into the YARN launch extraneous. The downside of this extra check is that there are some envvars related to Docker YARN LCE containers that appear to be set to empty strings. For example `YARN_CONTAINER_RUNTIME_DOCKER_IMAGE` appears to always be set to an empty string unless explicitly set. In my test environment I have something like the following in my `yarn-env.sh`: ``` export YARN_CONTAINER_RUNTIME_DOCKER_IMAGE='hadoop-yarn-lce:some-tag' ``` Checking `/proc/{PID}/environ` of the NodeManager process shows that `YARN_CONTAINER_RUNTIME_DOCKER_IMAGE` is set as expected. I also have `YARN_CONTAINER_RUNTIME_DOCKER_IMAGE` set as a whitelisted envvar with `yarn.nodemanager.env-whitelist` in `yarn-site.xml`. When I try and submit a job to be run within Docker with something like: ``` yarn \ org.apache.hadoop.yarn.applications.distributedshell.Client \ -jar /usr/lib/hadoop-yarn/hadoop-yarn-applications-distributedshell.jar \ -shell_command sleep -shell_args 10 \ -shell_env YARN_CONTAINER_RUNTIME_TYPE=docker ``` My expectation is that the default Docker image value set in the NM would be used however I get the following error because an empty string is causing `containesKey()` to true and skipping loading of the NM default value: ``` Exception from container-launch. Container id: container_e5300_1732314455042_0036_01_000002 Exit code: -1 Exception message: YARN_CONTAINER_RUNTIME_DOCKER_IMAGE not set! Shell error output: <unknown> Shell output: <unknown> [2024-11-22 23:54:04.582]Container exited with a non-zero exit code -1. ``` This issue happens with `YARN_CONTAINER_RUNTIME_DOCKER_MOUNTS` and perhaps other envvars as well. Interestingly it does not happen with `YARN_CONTAINER_RUNTIME_DOCKER_CONTAINER_HOSTNAME`
💔 -1 overall
This message was automatically generated. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
whitelistedEnv()
function writes a bash export for the environment using a default value syntax, e.g.:Which makes checking if
MY_VAR
exists in the environment passed into the YARN launch extraneous. The downside of this extra check is that there are some envvars related to Docker YARN LCE containers that appear to be set to empty strings.For example
YARN_CONTAINER_RUNTIME_DOCKER_IMAGE
appears to always be set to an empty string unless explicitly set. In my test environment I have something like the following in myyarn-env.sh
:Checking
/proc/{PID}/environ
of the NodeManager process shows thatYARN_CONTAINER_RUNTIME_DOCKER_IMAGE
is set as expected.I also have
YARN_CONTAINER_RUNTIME_DOCKER_IMAGE
set as a whitelisted envvar withyarn.nodemanager.env-whitelist
inyarn-site.xml
.When I try and submit a job to be run within Docker with something like:
My expectation is that the default Docker image value set in the NM would be used however I get the following error because an empty string is causing
containesKey()
to true and skipping loading of the NM default value:This issue happens with
YARN_CONTAINER_RUNTIME_DOCKER_MOUNTS
and perhaps other envvars as well. Interestingly it does not happen withYARN_CONTAINER_RUNTIME_DOCKER_CONTAINER_HOSTNAME
Description of PR
How was this patch tested?
For code changes:
LICENSE
,LICENSE-binary
,NOTICE-binary
files?