ATLAS Offline Software
DataQuality
DataQualityUtils
python
dqu_subprocess.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3
def
_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
11
def
apply
(func, args):
12
from
six.moves.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
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition:
SGImplSvc.cxx:70
python.dqu_subprocess._local_apply_core
def _local_apply_core(func, args, q)
Definition:
dqu_subprocess.py:3
python.dqu_subprocess.apply
def apply(func, args)
Definition:
dqu_subprocess.py:11
Generated on Thu Nov 7 2024 21:13:50 for ATLAS Offline Software by
1.8.18