MCPcopy Index your code
hub / github.com/python/cpython / prepare

Function prepare

Lib/multiprocessing/spawn.py:212–246  ·  view source on GitHub ↗

Try to get current process ready to unpickle process object

(data)

Source from the content-addressed store, hash-verified

210old_main_modules = []
211
212def prepare(data):
213 '''
214 Try to get current process ready to unpickle process object
215 '''
216 if 'name' in data:
217 process.current_process().name = data['name']
218
219 if 'authkey' in data:
220 process.current_process().authkey = data['authkey']
221
222 if 'log_to_stderr' in data and data['log_to_stderr']:
223 util.log_to_stderr()
224
225 if 'log_level' in data:
226 util.get_logger().setLevel(data['log_level'])
227
228 if 'sys_path' in data:
229 sys.path = data['sys_path']
230
231 if 'sys_argv' in data:
232 sys.argv = data['sys_argv']
233
234 if 'dir' in data:
235 os.chdir(data['dir'])
236
237 if 'orig_dir' in data:
238 process.ORIGINAL_DIR = data['orig_dir']
239
240 if 'start_method' in data:
241 set_start_method(data['start_method'], force=True)
242
243 if 'init_main_from_name' in data:
244 _fixup_main_from_name(data['init_main_from_name'])
245 elif 'init_main_from_path' in data:
246 _fixup_main_from_path(data['init_main_from_path'])
247
248# Multiprocessing module helpers to fix up the main module in
249# spawned subprocesses

Callers 3

_mainFunction · 0.70
_generic_class_getitemFunction · 0.50
_determine_new_argsMethod · 0.50

Calls 5

_fixup_main_from_nameFunction · 0.85
_fixup_main_from_pathFunction · 0.85
log_to_stderrMethod · 0.80
get_loggerMethod · 0.80
setLevelMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…