ATLAS Offline Software
Loading...
Searching...
No Matches
python.dqu_subprocess Namespace Reference

Functions

 _local_apply_core (func, args, q)
 apply (func, args)

Function Documentation

◆ _local_apply_core()

python.dqu_subprocess._local_apply_core ( func,
args,
q )
protected

Definition at line 3 of file dqu_subprocess.py.

3def _local_apply_core(func, args, q):
4 import os
5 try:
6 q.put(func(*args))
7 except Exception as e:
8 q.put(e)
9 os._exit(1)
10

◆ apply()

python.dqu_subprocess.apply ( func,
args )

Definition at line 11 of file dqu_subprocess.py.

11def apply(func, args):
12 from queue import Empty
13 from multiprocessing import Process
14 from multiprocessing.managers import SyncManager
15
16 with SyncManager() as m:
17 q = m.Queue()
18 p = Process(target=_local_apply_core, args=(func, args, q))
19 p.start()
20 p.join()
21 print('Manager socket is', m.address)
22 try:
23 rv = q.get(False)
24 except Empty:
25 raise RuntimeError('daughter died while trying to execute %s%s' % (func.__name__, args))
26 if isinstance(rv, BaseException):
27 if isinstance(rv, SystemExit):
28 print('SystemExit raised by daughter; ignoring')
29 return None
30 else:
31 raise rv
32 return rv
void print(char *figname, TCanvas *c1)