provide a mechanism for enforcing a timeout for salt commands to complete
It would be useful if there was a way to enforce a timeout period for any salt command, such that if any minion didn't respond or complete the command requested after X seconds, the command would give up (and cancel/cleanup what internal book keeping it had going on).
I'm hoping to use salt for as a monitoring tool (amongst other purposes), and I need a means of ensuring that the monitoring is going to run to completion at a specific time interval. Along these lines, I'd like to be able to specify a timeout which would be enforced on each minion. That way, if I ran a command (without any batching), and specified an X second timeout, i'd be reasonably confident that the entire command invocation from the master would exit within those X seconds.
Detailed discussion of this topic is here: https://groups.google.com/forum/?fromgroups=#!topic/salt-users/pjgF_vLH3-o
Thanks for making this so clear! =)
Hm, it'd be good indeed to just run salt '*' what.ever, and know what minions are online. Also, for tab completion it'd be rather important to have the ability to specify very small timeouts. (Of course caching the minion capabilities is a different story.)
Another use case: i have a minion that is in some bad, semi-hung state. It still answers salt commands, but never actually fully completes them, such that they will take forever to complete. Without an enforcible timeout, the salt command will never finish.
@basepi - I find this is a commonly requested feature for the reason that @netllama mentioned. It's hard to determine if the minion is broken or if there is a problem with the state/command being run. It seems to me that this feature could improve the "apparent reliability" of Salt by showing that the minion is functioning properly in these cases.
Is there any plan to implement this feature soon? Is it on the roadmap?
Not on the timeline at the moment, but we do want to implement this eventually. Right now our timeline is mostly "kill 600+ bugs". Only certain feature work for our upcoming enterprise UI has core dev time on it. We're working hard to hire more people so we can get some of our core dev team back from service delivery.
Okay, good to know. Thanks for the info!
We do this via a custom runner wrapper. In essence, we execute the runner and provide it the command and arguments we want to run. The runner takes care of executing the job async and then waits on the job return for a certain amount of time.
If that job return fails to show up, it then executes a kill_job on the job id and returns an error that the job timed out.
We do this for both runners and exec modules - although in the case of the runner jobs, it should be noted that you can't use the kill job functionality, since the job id you are given isn't a real 'jid', for the purposes of actually killing it - but it does work for any exec commands you're trying to run on minions.
It's not the best way of doing this - but it's a workaround we've had a bit of success with.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
This feature would be really nice!
I would still like to see this feature implemented. I have seen no indication that it exists yet other than for the cmd.run timeout=x argument. I'm not sure if this same argument is available for other modules besides cmd. Example:
test@salt:/# salt test_minion cmd.run 'sleep 45' timeout=5
test_minion:
sleep 45 : Timed out after 5 seconds
As @netllama mentioned in the use case, I occasionally have minions that are in bad states/hung but will still respond to salt commands and continue to run jobs while the master will wait seemingly indefinitely for that one minion to return. I know there are workarounds to this (async, wrapper scripts, etc), but I would hope a global hard timeout could be configured at some point.
Here's to hoping that this comment makes this issue no longer stale.
Thank you for updating this issue. It is no longer marked as stale.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.