ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Generators
PowhegControl
python
algorithms
postprocessors
postprocessors/directory_cleaner.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2
3
from
...
import
Logging
4
from
...decorators
import
timed
5
import
glob
6
import
os
7
8
9
logger = Logging.logging.getLogger(
"PowhegControl"
)
10
11
12
@timed("directory cleaner")
13
def
directory_cleaner(process):
14
"""! Clean up the directory after running.
15
16
Remove any leftover files to avoid clutter.
17
18
@author James Robinson <james.robinson@cern.ch>
19
"""
20
nRemoved, nFailures = 0, 0
21
for
file_name
in
sum([glob.glob(_f)
for
_f
in
process.files_for_cleanup], []):
22
logger.debug(
"... removing unneeded file: {}"
.format(file_name))
23
try
:
24
os.remove(file_name)
25
except
OSError:
26
logger.debug(
"... could not remove {}"
.format(file_name))
27
nFailures += 1
28
nRemoved += 1
29
logger.info(
"... removed {} unneeded files with a further {} failures"
.format(nRemoved, nFailures))
Generated on
for ATLAS Offline Software by
1.17.0