Skip to content

Instantly share code, notes, and snippets.

@mumumu
Created October 13, 2017 09:52
Show Gist options
  • Save mumumu/ffb9153b38e4795274bc47d3b85ffab3 to your computer and use it in GitHub Desktop.
Save mumumu/ffb9153b38e4795274bc47d3b85ffab3 to your computer and use it in GitHub Desktop.
[PATCH] output parallel task execution result stats
--- fabric/tasks.py 2017-04-24 19:28:00.000000000 -0400
+++ fabric/tasks.py.new 2017-10-13 09:41:45.617000206 -0400
@@ -409,6 +409,22 @@
# This prevents Fabric from continuing on to any other tasks.
# Otherwise, pull in results from the child run.
ran_jobs = jobs.run()
+ print "----"
+ from collections import Counter
+ c = Counter()
+ failed_hosts = []
+ for name, d in ran_jobs.iteritems():
+ if d['exit_code'] == 0:
+ c[0] += 1
+ else:
+ c[1] += 1
+ failed_hosts.append(name)
+
+ print "success: %s, failure: %s" % (c[0], c[1])
+ if failed_hosts:
+ print "failed_hosts: \n%s" % ("\n".join(failed_hosts))
+
+ print "----"
for name, d in ran_jobs.iteritems():
if d['exit_code'] != 0:
if isinstance(d['results'], NetworkError) and \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment