Skip to content

Commit

Permalink
fix python2 to 3 issue with NonDaemonPool within Pool.Process as part…
Browse files Browse the repository at this point in the history
  • Loading branch information
wjia7 committed Jan 7, 2020
1 parent f2de331 commit 25ccb15
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion maestro/core/module.py
Expand Up @@ -41,7 +41,21 @@ def _set_daemon(self, value):


class NonDaemonizedPool(Pool):
Process = NoDaemonProcess
def Process(self, *args, **kwds):
proc = super(NonDaemonizedPool, self).Process(*args, **kwds)

class NonDaemonProcess(proc.__class__):
"""Monkey-patch process to ensure it is never daemonized"""
@property
def daemon(self):
return False

@daemon.setter
def daemon(self, val):
pass

proc.__class__ = NonDaemonProcess
return proc

# TODO: change modules to accept kwargs and args

Expand Down

0 comments on commit 25ccb15

Please sign in to comment.