File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 44
44
import random
45
45
import threading
46
46
import multiprocessing
47
+ import multiprocessing .managers
47
48
import io
48
49
import shlex
49
50
import inspect
71
72
io_lock = threading .Lock ()
72
73
console_lock = threading .Lock ()
73
74
74
- # globally usable manager for mp objects
75
- mp_manager = multiprocessing .Manager ()
76
-
77
75
78
76
class NoValue (object ):
79
77
@@ -101,6 +99,21 @@ def __str__(self):
101
99
no_value = NoValue ()
102
100
103
101
102
+ def MPManager (** kwargs ):
103
+ """
104
+ Factory function identical to :py:func:`multiprocessing.Manager` but allows for additional
105
+ arguments to be forwarded to the underlying :py:class:`multiprocessing.managers.SyncManager`.
106
+ """
107
+ kwargs .setdefault ("ctx" , multiprocessing .context ._default_context .get_context ())
108
+ manager = multiprocessing .managers .SyncManager (** kwargs )
109
+ manager .start ()
110
+ return manager
111
+
112
+
113
+ # globally usable manager for mp objects
114
+ mp_manager = MPManager (address = ("localhost" , 0 ))
115
+
116
+
104
117
def rel_path (anchor , * paths ):
105
118
"""
106
119
Returns a path made of framgment *paths* relativ to an *anchor* path. When *anchor* is a file,
You can’t perform that action at this time.
0 commit comments