* [gentoo-commits] proj/portage:master commit in: pym/portage/util/futures/executor/
@ 2018-04-11 2:02 Zac Medico
0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2018-04-11 2:02 UTC (permalink / raw
To: gentoo-commits
commit: 52d4689740f5f9fcf1cf7423e3fe4089dbb4c718
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 11 02:01:43 2018 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Apr 11 02:01:43 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=52d46897
ForkExecutor: support asyncio via _PortageEventLoopPolicy (bug 649588)
Support portage's internal EventLoop as well as the _PortageEventLoop
asyncio compatibility wrapper, by using the respective _loop and
_asyncio_wrapper attributes where appropriate.
Bug: https://bugs.gentoo.org/649588
pym/portage/util/futures/executor/fork.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/pym/portage/util/futures/executor/fork.py b/pym/portage/util/futures/executor/fork.py
index 496b4e892..919a72bfd 100644
--- a/pym/portage/util/futures/executor/fork.py
+++ b/pym/portage/util/futures/executor/fork.py
@@ -25,7 +25,8 @@ class ForkExecutor(object):
"""
def __init__(self, max_workers=None, loop=None):
self._max_workers = max_workers or multiprocessing.cpu_count()
- self._loop = loop or global_event_loop()
+ loop = loop or global_event_loop()
+ self._loop = getattr(loop, '_asyncio_wrapper', loop)
self._submit_queue = collections.deque()
self._running_tasks = {}
self._shutdown = False
@@ -53,7 +54,7 @@ class ForkExecutor(object):
future, proc = self._submit_queue.popleft()
future.add_done_callback(functools.partial(self._cancel_cb, proc))
proc.addExitListener(functools.partial(self._proc_exit, future))
- proc.scheduler = self._loop
+ proc.scheduler = self._loop._loop
proc.start()
self._running_tasks[id(proc)] = proc
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/futures/executor/
@ 2018-04-12 8:34 Zac Medico
0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2018-04-12 8:34 UTC (permalink / raw
To: gentoo-commits
commit: ae59758e395393601a389ede4f4b521db6786139
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 12 08:25:17 2018 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Apr 12 08:30:49 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=ae59758e
ForkExecutor: fix shutdown to handle empty self._running_tasks
pym/portage/util/futures/executor/fork.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pym/portage/util/futures/executor/fork.py b/pym/portage/util/futures/executor/fork.py
index 919a72bfd..51367f934 100644
--- a/pym/portage/util/futures/executor/fork.py
+++ b/pym/portage/util/futures/executor/fork.py
@@ -96,6 +96,8 @@ class ForkExecutor(object):
def shutdown(self, wait=True):
self._shutdown = True
+ if not self._running_tasks and not self._shutdown_future.done():
+ self._shutdown_future.set_result(None)
if wait:
self._loop.run_until_complete(self._shutdown_future)
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-12 8:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-11 2:02 [gentoo-commits] proj/portage:master commit in: pym/portage/util/futures/executor/ Zac Medico
-- strict thread matches above, loose matches on Subject: below --
2018-04-12 8:34 Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox