-
Notifications
You must be signed in to change notification settings - Fork 86
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
Return maxrc properly for Rsh Worker #448
Conversation
The current version of the Rsh Worker does not properly return the max error code with the -S option. This commit adds in a little "magic" to the end of the rsh command to pass back the return code when requested. Basically works exactly as pdsh does to extract the return code.
Thanks @hawartens for your PR. I'm seeing that your code change is actually adding this little "magic" and also adding I'm not against adding this option in config file is you think this is useful, but it seems you did this to propagate the Checking the code, that would means |
Thanks @degremont. Correct I added the maxrc option so that I could propagate it nicely down to the worker code a little more cleanly. I wanted the code to behave more like pdsh in this respect and not add the magic unless it was necessary. It is possible to grab maxrc in the Worker by looking at self.worker.eh._display.maxrc but it felt that would be violating your intent. If you prefer, I can package this as two commits (I did it together for the exact reason you surmised). |
Understood for the |
Sure.
This manage shows the reason:
|
Oh! I understood now how this trick makes sense. |
I patterned it after the way it works in Pdsh. We only do the "magic" if the user requests it. This way we do not do any extra work if it is not necessary. If you would prefer to have it done all the time, that is okay with me, was just trying to avoid doing it unless it was specifically asked for. |
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 your PR. I would prefer to avoid adding a new clush option maxrc which would be confusing, and rather fix the max return code with the Rsh worker. Users of library could also benefit from this when the Rsh worker is used, and thus get proper return codes in that case. I think the overhead is minimal. Let us know if you can update your PR in that sense.
I add some coding guidelines for this feature. I'm inline with @thiell and limit this PR to the rc feature. Don't include maxrc change here. |
This reverts commit 65223a7.
The current version of the Rsh Worker does not properly return the max error code with the -S option. This commit adds in a little "magic" to the end of the rsh command to pass back the return code.
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 the update! The principles are what I was looking for. I requested small changes.
Make sure to call parent ExecClient._on_nodeset_msgline() instead of self.worker._on_node_msgline() to ensure special handling takes place. Make sure to call parent ExecClient._on_nodeset_close() instead of self.worker._on_node_close() to ensure special handling takes place. Override _on_nodeset_start() as well. Wanted to ensure that instance variable rsh_rc would be set to None (seemed cleaner than overriding __init__). Fix error where magic string could be seen by client.
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.
Overall I'm ok. Just a minor comment. I will let @thiell double check, especially the utf thing.
Move initialization of rsh_rc to __init__()
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.
Looks very good overall. I would just fix the decode() method to avoid the explicit utf-8 encoding. Thanks so much.
The current version of the Rsh Worker does not properly return
the max error code with the -S option. This commit adds in a little
"magic" to the end of the rsh command to pass back the return code
when requested. Basically works exactly as pdsh does to extract the
return code.