Close project if one one the compute of the project is down

Fix #836
This commit is contained in:
Julien Duponchelle committed 2016-12-15 21:57:59 +01:00
1 parent 60eea1f171
commit 3259ec1220
6 files changed
+32 -13

No files matched your search

+4 -1
View File
@@ -36,6 +36,7 @@ class Pool():
Wait for all task to finish
"""
pending = set()
exceptions = set()
while len(self._tasks) > 0 or len(pending) > 0:
while len(self._tasks) > 0 and len(pending) < self._concurrency:
task, args, kwargs = self._tasks.pop(0)
@@ -43,7 +44,9 @@ class Pool():
(done, pending) = yield from asyncio.wait(pending, return_when=asyncio.FIRST_COMPLETED)
for task in done:
if task.exception():
raise task.exception()
exceptions.add(task.exception())
if len(exceptions) > 0:
raise exceptions.pop()
def main():