-
Notifications
You must be signed in to change notification settings - Fork 191
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
verdi computer
option to switch off login shell
#4271
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #4271 +/- ##
===========================================
+ Coverage 79.19% 79.24% +0.05%
===========================================
Files 468 468
Lines 34476 34488 +12
===========================================
+ Hits 27301 27325 +24
+ Misses 7175 7163 -12
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
Thanks for this PR, @unkcpz !
I was originally responsible for switching to using the login shell, the reason is explained in #1502, but if there are systems that force outputs on login shells that a user cannot suppress, then I guess it makes sense to be able to not use a login shell.
I think making this configurable is potentially quite useful.
Some minor change requests.
@giovannipizzi Do you agree with making this configurable?
It does mean another "variable" one has to keep in mind when debugging things...
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.
Thanks @ltalirz
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.
thanks @unkcpz , for me this is good to go.
would be good to have a brief feedback from @giovannipizzi or @sphuber as well.
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.
Thanks @unkcpz . I have gone through the issue and the original commit that added the -l
flag by default, and based on the information provided there this seems reasonable, especially since the default remains untouched. But I have to say that I don't have an enormous amount of experience with the difference in interactive and non-interactive shells. I have just two minor suggestions for help strings, but won't force an update. Would be good if @giovannipizzi can maybe give a final sign off
aiida/transports/plugins/ssh.py
Outdated
'default': True, | ||
'switch': True, | ||
'prompt': 'Use login shell when executing command', | ||
'help': ' Avoiding a login shell can help suppress spurious text output' |
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.
'help': ' Avoiding a login shell can help suppress spurious text output' | |
'help': 'Not using a login shell can help suppress any potential spurious text output that can interfere with AiiDA executing commands, ' |
I guess it might not be immediately clear why suppressing spurious output is something desirable, per se.
I just realized that this can also apply to And finally, if I understand correctly, this would then solve #2978 ? Actually, that made me realize that probably we will want to add a small note about this new switch in this part of the documentation troubleshooting.
|
It's true that this does make a difference for local transports as well. |
emm.. that's true. So, put this option to setup? |
Thanks @unkcpz ! A few final points:
|
I think |
ok, I'll also add it to local transports.
I add a simple test to check that autoinfo getting set with this option. @giovannipizzi |
9d7a4fb
to
a109608
Compare
The
|
@ltalirz I find one more place where login shell is used, here at aiida-core/aiida/transports/plugins/ssh.py Line 1305 in 0d7baa5
why force user to bash login shell when they goto the specific computer, is that necessary? If there are spurious output being printed the login shell here will also cause problem. |
I think it's the expected behavior - a user will expect the same environment variables as when connecting manually and changing to that directory, no?
If it causes problems, then we may need to make it configurable here as well, but I'm not aware that AiiDA is processing the output of this command. |
Ah, the problem comes from the |
For transports plugins(now we have ssh and local), add `use_login_shell` option to allowed user to not use login shell when executing the command.
@ltalirz thanks! looks better now. |
Just so that I understand: some system-level bashrc file is being sourced only for login shells, and this breaks the In any case, reading back through what I wrote, I think you were right after all. Given the issue you encountered, I think it's best apply the user configuration in |
I am not very familiar with login/non-login and interactive/non-interactive shell stuff, correct me if I understand it wrong.
My fault for not clarifying this, not the system-level bashrc but the user's
Agree! If the |
`bash_command` are used in three places and set by `use_login_shell`. Encapsulate it as attribute `_bash_command_str` of `Transport`. gotocompyter_command have same string for local and ssh transport plugin, Encapsulate the string as `_gotocomputer_string` in `Transport` class.
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.
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.
Thanks a lot @unkcpz
Issue closing #2978 happened to me when connecting to TianHe-2 . The messages output to the login shell was set in file
/etc/profile
. I make a rough fix and let it set inverdi computer configuration ssh
.EDIT:
local transport plugin should also configurable with on/off login shell. As well as
gotocomputer_command
of all transport plugins. To avoid repeating definebash_command
and repeating gotocomputer command string, encapsulating them inTranport
class.