-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
[autoscaler] Make commands bash -i
to support newer bash
#4181
Conversation
"export OMP_NUM_THREADS=1 PYTHONWARNINGS=ignore && ") | ||
cmd = "bash --login -c {}".format(quote(force_interactive + cmd)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm I remember there was a reason why we didn't do this...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line 276 with bash -i
is also a way to force the interactive shell, according to man bash
:
...
OPTIONS
All of the single-character shell options documented in the description of the set builtin command can be used as options when the shell is
invoked. In addition, bash interprets the following options when it is invoked:
-c If the -c option is present, then commands are read from the first non-option argument command_string. If there are arguments after
the command_string, the first argument is assigned to $0 and any remaining arguments are assigned to the positional parameters. The
assignment to $0 sets the name of the shell, which is used in warning and error messages.
-i If the -i option is present, the shell is interactive.
...
So basically the set -i
is moved to the options of invoking bash, which is compatible with both bash 4.3 and 4.4.
Maybe this is not a valid test, but I've tried with according to the answer on ask ubuntu.
Both in ubuntu 16.04 and 18.04:
bash --login -c 'echo $-;'
#result is hBc, the set status in shell
bash --login -c -i 'echo $-;'
#result is himBHc
in Ubuntu 16.04:
bash --login -c 'set -i || true && echo $-;'
#result is hiBc
the status i is set after added the -i
by invoking bash, the side effect is that m
and H
are set either. Checking the meaning of them in the help function of set
, which gives out:
-m Job control is enabled.
-H Enable ! style history substitution. This flag is on
by default when the shell is interactive.
So I think these two side effects are not so critical for our use case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see; OK at a high level it looks OK.
Before merging I'd (or someone else can do it) want to check whether our default autoscaler scripts work still for AWS and GCP; namely if appending the conda path to the bashrc still has the same behavior as before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this and it seems fine on AWS / DL AMIs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also seems fine on GCP with the nvidia-docker examples.
Test FAILed. |
bash -i
to support newer bash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hartikainen can you take a look (in case we break your workflow ;)
I tested this on the nvidia-docker example on GCP, and things look good! |
Test FAILed. |
What do these changes do?
the generated command in autoscaler/updater.py throws non-zero exit status 127 on Ubuntu 18.04, for detailed description please check the related issue below.
Related issue number
Closes #4155, Closes #1444.