mirror of https://gitlab.com/pamhyr/pamhyr2
AdisTS: remove TEM files generated in results AdisTS (probably due to new solver version, including Temperature)
parent
9161c54e18
commit
80f0b181d1
|
|
@ -408,6 +408,41 @@ class AdisTS(CommandLineSolver):
|
|||
# RESULTS #
|
||||
###########
|
||||
|
||||
@staticmethod
|
||||
def _remove_temperature_results(repertory):
|
||||
"""Remove temperature outputs generated but unused by AdisTS."""
|
||||
results_directory = os.path.join(repertory, "resultats")
|
||||
if not os.path.isdir(results_directory):
|
||||
results_directory = repertory
|
||||
|
||||
if not os.path.isdir(results_directory):
|
||||
return
|
||||
|
||||
for filename in os.listdir(results_directory):
|
||||
if not (filename.startswith("TEM.") or
|
||||
filename.startswith("TEM_")):
|
||||
continue
|
||||
|
||||
filepath = os.path.join(results_directory, filename)
|
||||
if os.path.isfile(filepath):
|
||||
try:
|
||||
os.remove(filepath)
|
||||
logger.debug(
|
||||
f"Removed unused AdisTS result '{filepath}'"
|
||||
)
|
||||
except OSError as error:
|
||||
logger.warning(
|
||||
f"Unable to remove AdisTS result '{filepath}': "
|
||||
f"{error}"
|
||||
)
|
||||
|
||||
def run_output_data_fomater(self, study):
|
||||
# AdisTS generates temperature results that are not used by the solver,
|
||||
# but they are still present in the output directory.
|
||||
# Remove them to avoid confusion.
|
||||
self._remove_temperature_results(self._process.workingDirectory())
|
||||
return super(AdisTS, self).run_output_data_fomater(study)
|
||||
|
||||
def read_bin(self, study, repertory, results, qlog=None, name="0"):
|
||||
return
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue