diff options
author | Jeroen Hoekx <jeroen.hoekx@hamok.be> | 2012-04-30 09:47:04 +0200 |
---|---|---|
committer | Michael DeHaan <michael.dehaan@gmail.com> | 2012-05-01 18:38:26 -0400 |
commit | f14c1e3e917d33ea58c5c89d109feac8fbeedd38 (patch) | |
tree | f2e092e9ee3be6c2c3b8f071e35fdbfc6224c4c8 /lib/ansible/callbacks.py | |
parent | 029fe1273cd33e06591de7086b8db6df8838f2e2 (diff) | |
download | ansible-f14c1e3e917d33ea58c5c89d109feac8fbeedd38.tar.gz |
Async: print one poll message per polling cycle.
Instead of one per host per polling cycle.
Diffstat (limited to 'lib/ansible/callbacks.py')
-rw-r--r-- | lib/ansible/callbacks.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/ansible/callbacks.py b/lib/ansible/callbacks.py index 0f9764b294..256ceb5586 100644 --- a/lib/ansible/callbacks.py +++ b/lib/ansible/callbacks.py @@ -115,6 +115,7 @@ class CliRunnerCallbacks(DefaultRunnerCallbacks): def __init__(self): # set by /usr/bin/ansible later self.options = None + self._async_notified = {} def on_failed(self, host, res): invocation = res.get('invocation','') @@ -141,7 +142,11 @@ class CliRunnerCallbacks(DefaultRunnerCallbacks): print >>sys.stderr, "no hosts matched\n" def on_async_poll(self, host, res, jid, clock): - print "<job %s> polling on %s, %s remaining"%(jid, host, clock) + if jid not in self._async_notified: + self._async_notified[jid] = clock + 1 + if self._async_notified[jid] > clock: + self._async_notified[jid] = clock + print "<job %s> polling, %ss remaining"%(jid, clock) def on_async_ok(self, host, res, jid): print "<job %s> finished on %s => %s"%(jid, host, utils.bigjson(res)) @@ -161,6 +166,7 @@ class PlaybookRunnerCallbacks(DefaultRunnerCallbacks): def __init__(self, stats): self.stats = stats + self._async_notified = {} def on_unreachable(self, host, msg): print "fatal: [%s] => %s" % (host, msg) @@ -191,7 +197,11 @@ class PlaybookRunnerCallbacks(DefaultRunnerCallbacks): print "no hosts matched or remaining\n" def on_async_poll(self, host, res, jid, clock): - print "<job %s> polling on %s, %s remaining"%(jid, host, clock) + if jid not in self._async_notified: + self._async_notified[jid] = clock + 1 + if self._async_notified[jid] > clock: + self._async_notified[jid] = clock + print "<job %s> polling, %ss remaining"%(jid, clock) def on_async_ok(self, host, res, jid): print "<job %s> finished on %s"%(jid, host) |