Skip to content
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

Merged
merged 2 commits into from
Mar 3, 2019

Conversation

yangpeiren
Copy link
Contributor

@yangpeiren yangpeiren commented Feb 27, 2019

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.

"export OMP_NUM_THREADS=1 PYTHONWARNINGS=ignore && ")
cmd = "bash --login -c {}".format(quote(force_interactive + cmd))
Copy link
Contributor

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...

#1444

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/12357/
Test FAILed.

@richardliaw richardliaw changed the title autoscaler/updater.py generates invalid commands on Ubuntu 18.04 [autoscaler] Make commands bash -i to support newer bash Mar 3, 2019
Copy link
Contributor

@richardliaw richardliaw left a 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 ;)

@hartikainen
Copy link
Contributor

I tested this on the nvidia-docker example on GCP, and things look good!

@richardliaw richardliaw self-assigned this Mar 3, 2019
@richardliaw richardliaw merged commit e2e6ef1 into ray-project:master Mar 3, 2019
@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/12506/
Test FAILed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cluster update script throws exception on Ubuntu 18.04 [autoscaler] bash 4.4 does not support set -i
5 participants