summaryrefslogtreecommitdiff
path: root/distbuild/mainloop.py
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-02-11 12:13:41 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2015-02-11 12:53:58 +0000
commitd0143c276f31bf9de26dfbe92d64693cdcbd2014 (patch)
tree809f852a285c704c8a84fef092e60b2a2707a42b /distbuild/mainloop.py
parenta006c418d3cc81d6d4a4353a43133b40486a6610 (diff)
downloadmorph-d0143c276f31bf9de26dfbe92d64693cdcbd2014.tar.gz
distbuild: Fix case where 'computing build graph' would hang forever
If there's no distbuild-helper process running on the controller then the controller would hang forever. This situation is unlikely, but it's important to give the user feedback instead of silently hanging forever.
Diffstat (limited to 'distbuild/mainloop.py')
-rw-r--r--distbuild/mainloop.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/distbuild/mainloop.py b/distbuild/mainloop.py
index f0e5eebc..8c46b2fb 100644
--- a/distbuild/mainloop.py
+++ b/distbuild/mainloop.py
@@ -56,7 +56,10 @@ class MainLoop(object):
def remove_state_machine(self, machine):
logging.debug('MainLoop.remove_state_machine: %s' % machine)
self._machines.remove(machine)
-
+
+ def n_state_machines_of_type(self, machine_type):
+ return len([m for m in self._machines if isinstance(m, machine_type)])
+
def add_event_source(self, event_source):
logging.debug('MainLoop.add_event_source: %s' % event_source)
self._sources.append(event_source)