Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update zip.py #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions zogyp/zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,24 @@ def config_loc(): #Quick function to find config files

#####################################################################################################################
class NoDaemonProcess(multiprocessing.Process):
"""
These two classes allow the daemons to have children... how nice
Basically, allows a function in a pool to use its own pool
"""
# make 'daemon' attribute always return False
def _get_daemon(self):
@property
def daemon(self):
return False
def _set_daemon(self, value):

@daemon.setter
def daemon(self, value):
pass
daemon = property(_get_daemon, _set_daemon)

class NoDaemonContext(type(multiprocessing.get_context())):
Process = NoDaemonProcess

# We sub-class multiprocessing.pool.Pool instead of multiprocessing.Pool
# because the latter is only a wrapper function, not a proper class.
class NoDaemonProcessPool(multiprocessing.pool.Pool):
Process = NoDaemonProcess
def __init__(self, *args, **kwargs):
kwargs['context'] = NoDaemonContext()
super(NoDaemonProcessPool, self).__init__(*args, **kwargs)
# https://stackoverflow.com/questions/6974695/python-process-pool-non-daemonic
#####################################################################################################################


Expand Down