ATLAS Offline Software
Loading...
Searching...
No Matches
singlecore.py
Go to the documentation of this file.
1# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2
3from ...decorators import timed
4from ...utility import ProcessManager, SingleProcessThread
5import os
6
7
8@timed("single-core generation")
9def singlecore(process):
10 """! Run a single Powheg process in its own timed thread.
11
12 @param process PowhegBox process.
13
14 @author James Robinson <james.robinson@cern.ch>
15 """
16 singlecore_untimed(process)
17
18
19def singlecore_untimed(process):
20 """! Run a single Powheg process in its own thread.
21
22 @param process PowhegBox process.
23
24 @author James Robinson <james.robinson@cern.ch>
25 """
26 if not os.path.isfile(process.executable):
27 raise OSError("Powheg executable {} not found!".format(process.executable))
28 threads = [SingleProcessThread(process.executable,
29 warning_output=(process.warning_output if hasattr(process,"warning_output") else None),
30 info_output=(process.info_output if hasattr(process,"info_output") else None),
31 error_output=(process.error_output if hasattr(process,"error_output") else None))]
32 manager = ProcessManager(threads)
33 while manager.monitor():
34 pass
Wrapper to handle multiple Powheg subprocesses.
Single executable running in a subprocess (usually PowhegBox).
singlecore_untimed(process)
Run a single Powheg process in its own thread.
Definition singlecore.py:19