-
Notifications
You must be signed in to change notification settings - Fork 367
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
Adding command_timeout
option for run()
#645
Conversation
23f8169
to
ce0e7ce
Compare
current fabric would raise: |
b69e4ec
to
2342d91
Compare
thanks @bentsi for the review |
@fruch please edit PR info with updated details |
2342d91
to
626350f
Compare
My personal checklist for this (will branch and hack shortly):
|
Notes for posterity about tweaks I'm making here:
|
Here's an interesting wrinkle, this patch implicitly decides that we don't timeout if Arguably, there's precedent, which is that This is really subtle; in fact I'm not even sure that watcher errors are correct in being exempt from |
Thanks @bitprophet, As for the warn=True, cause that logic was there already ontop of As the naming of things, I was using something we already had in our code, it can be shorter and clean here. One more thing to add, Thanks again for looking into it |
Got back on this today. Still a little on the fence about the exception name, but everything else is cleaned up at this point. I moved the timer implementation to Local where I think it belongs (Runner itself should not know or care about the details, only whether the subprocess is considered to have timed out - thus a new property is born) and most of my above checklist as well - many more tests, including integration, edge cases etc. Docstrings, versionadded's, changelog entry. See https://github.com/pyinvoke/invoke/compare/645-int Tackling Fabric 2's side should go swiftly, tomorrow, and then I can merge both and move on to other tickets. This all took a lot of effort for w/e reason :( |
Famous last words, eh? May need to tweak this further for it to work for Fabric, see fabric/fabric#1989 (comment) and maybe subsequent. |
Did a big ol overhaul based on those comments and I think I like the result better. Runner itself now owns the timer stuff, defines a new API member This also handily removes a lot of the worry about backwards compatibility - eg a currently-released Fabric 2 trying to use this new Invoke version will only end up invoking a too-new API on an actual timeout - which that version of Fabric won't know how to request. I think. It's been a long day. |
Added CLI flags, tidied up the Fabric side of things, and merged everything to respective masters. Done?! |
@bitprophet thanks a lot, there new versions uploaded to pypi ? for this and for fabric ? |
@fruch Yes, Invoke 1.3 and Fabric 2.5 went up yesterday! |
since those two PR were merged by Jeff: * pyinvoke/invoke#645 * fabric/fabric#1989
since those two PR were merged by Jeff: * pyinvoke/invoke#645 * fabric/fabric#1989
since those two PR were merged by Jeff: * pyinvoke/invoke#645 * fabric/fabric#1989
since those two PR were merged by Jeff: * pyinvoke/invoke#645 * fabric/fabric#1989
since those two PR were merged by Jeff: * pyinvoke/invoke#645 * fabric/fabric#1989
since those two PR were merged by Jeff: * pyinvoke/invoke#645 * fabric/fabric#1989 (cherry picked from commit 58eb4ee)
since those two PR were merged by Jeff: * pyinvoke/invoke#645 * fabric/fabric#1989 (cherry picked from commit 58eb4ee)
Adding a parameter command_timeout for run() calls,
on
Local()
runner it would set a threading.Timer and when expire would callos.kill(pid, signal.SIGKILL)
would raise an CommandTimedOut exception.
This implementation would enable fabric to use this new parameter on it's paramiko
channel.settimeout()
before running the command.