Skip to content

Commit

Permalink
Close QuantumESPRESSO logger before instantiating internal EasyBlock
Browse files Browse the repository at this point in the history
This fixes the increased memory usage when running the EasyConfig test suite
as log files would stay open.

Signed-off-by: Jan André Reuter <[email protected]>
  • Loading branch information
Thyre committed Nov 12, 2024
1 parent 28b2084 commit f0ffe6d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions easybuild/easyblocks/q/quantumespresso.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
@author: Kenneth Hoste (Ghent University)
@author: Ake Sandgren (HPC2N, Umea University)
@author: Davide Grassano (CECAM, EPFL)
@author: Jan Reuter (Juelich Supercomputing Centre)
"""

import fileinput
Expand Down Expand Up @@ -82,6 +83,13 @@ def __init__(self, ec, *args, **kwargs):
self.log.info('Using CMake easyblock for Quantum ESPRESSO')
eb = EB_QuantumESPRESSOcmake

# Close log, as the selected EasyBlock will have its own log.
# If not closed, the log may be written multiple times, which has been observed
# during the EasyConfig test suite. We need to do this before instantiating the
# selected EasyBlock to prevent overwriting the logger, essentially resulting
# in the same issue (due to __getattribute__).
super(EB_QuantumESPRESSO, self).close_log()

# Required to avoid CMakeMake default extra_opts to override the ConfigMake ones
new_ec = EasyConfig(ec.path, extra_options=eb.extra_options())
self.ebclass = eb(new_ec, *args, **kwargs)
Expand Down

0 comments on commit f0ffe6d

Please sign in to comment.