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 @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. |
thiell
left a comment
There was a problem hiding this comment.
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.
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.
degremont
left a comment
There was a problem hiding this comment.
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.
Move initialization of rsh_rc to __init__()
thiell
left a comment
There was a problem hiding this comment.
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.