ATLAS Offline Software
Loading...
Searching...
No Matches
output_file_renamer.py
Go to the documentation of this file.
1# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2
3from AthenaCommon import Logging
4from ...decorators import timed
5import os
6
7
8logger = Logging.logging.getLogger("PowhegControl")
9
10
11@timed("output file renaming")
12def output_file_renamer(output_events_name, powheg_LHE_output):
13 """! Move output to correctly named file.
14
15 @param output_file_name Name of output LHE file.
16 @param powheg_LHE_output Name of LHE file produced by PowhegBox.
17
18 @author James Robinson <james.robinson@cern.ch>
19 """
20 logger.info("Starting to run PowhegControl output file renamer")
21 try:
22 os.rename(powheg_LHE_output, output_events_name)
23 logger.info("Moved {} to {}".format(powheg_LHE_output, output_events_name))
24 except OSError:
25 logger.warning("No output LHEF file found! Probably because the Powheg process was killed before finishing.")
26 raise RuntimeError("No output LHEF file produced by Powheg. Terminating job.")