From 377bbf170de0ed545bebefa612d301b51d0a3b68 Mon Sep 17 00:00:00 2001 From: Bruno Ploumhans <13494793+Technici4n@users.noreply.github.com> Date: Sat, 9 Nov 2024 17:50:03 +0100 Subject: [PATCH] Remove AiidaDFTK.jl log file handling (#13) --- src/aiida_dftk/calculations.py | 10 +--------- src/aiida_dftk/parsers.py | 10 ---------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/src/aiida_dftk/calculations.py b/src/aiida_dftk/calculations.py index c335d91..5724415 100644 --- a/src/aiida_dftk/calculations.py +++ b/src/aiida_dftk/calculations.py @@ -53,9 +53,7 @@ def define(cls, spec): options['withmpi'].default = True # Exit codes - # TODO: Log file should be removed in favor of using stdout. Needs a change in AiidaDFTK.jl. - # TODO: Code 100 is already used in the super class! - spec.exit_code(100, 'ERROR_MISSING_LOG_FILE', message='The output file containing DFTK logs is missing.') + # TODO: Codes 1xx are already used in the super class! spec.exit_code(101, 'ERROR_MISSING_SCFRES_FILE', message='The output file containing SCF results is missing.') spec.exit_code(102, 'ERROR_MISSING_FORCES_FILE', message='The output file containing forces is missing.') spec.exit_code(103, 'ERROR_MISSING_STRESSES_FILE', message='The output file containing stresses is missing.') @@ -178,11 +176,6 @@ def _generate_cmdline_params(self) -> ty.List[str]: cmd_params.extend(['-e', 'using AiidaDFTK; AiidaDFTK.run()', self.metadata.options.input_filename]) return cmd_params - @staticmethod - def get_log_file(input_filename: str) -> str: - """Gets the name of the log file based on the name of the input file.""" - return Path(input_filename).stem + '.log' - def _generate_retrieve_list(self, parameters: orm.Dict) -> list: """Generate the list of files to retrieve based on the type of calculation requested in the input parameters. @@ -195,7 +188,6 @@ def _generate_retrieve_list(self, parameters: orm.Dict) -> list: f"{item['$function']}.json" if item['$function'] == 'compute_bands' else f"{item['$function']}.hdf5" for item in parameters['postscf'] ] - retrieve_list.append(DftkCalculation.get_log_file(self.inputs.metadata.options.input_filename)) retrieve_list.append('timings.json') retrieve_list.append(f'{self.SCFRES_SUMMARY_NAME}') return retrieve_list diff --git a/src/aiida_dftk/parsers.py b/src/aiida_dftk/parsers.py index 470533d..0356c8b 100644 --- a/src/aiida_dftk/parsers.py +++ b/src/aiida_dftk/parsers.py @@ -1,12 +1,9 @@ # -*- coding: utf-8 -*- """`Parser` implementation for DFTK.""" import json -from os import path import pathlib as pl -from tempfile import TemporaryDirectory import numpy as np -from aiida.common.exceptions import NotExistent from aiida.engine import ExitCode from aiida.orm import ArrayData, Dict from aiida.parsers import Parser @@ -34,13 +31,6 @@ class DftkParser(Parser): def parse(self, **kwargs): """Parse DFTK output files.""" - log_file_name = DftkCalculation.get_log_file(self.node.get_options()["input_filename"]) - if log_file_name not in self.retrieved.base.repository.list_object_names(): - return self.exit_codes.ERROR_MISSING_LOG_FILE - # TODO: how to make this log available? This unfortunately doesn't output to the process report. - # TODO: maybe DFTK could log in a way that allows us to map its log levels to aiida's - self.logger.info(self.retrieved.base.repository.get_object_content(log_file_name)) - # if ran_out_of_walltime (terminated illy) if self.node.exit_status == DftkCalculation.exit_codes.ERROR_SCHEDULER_OUT_OF_WALLTIME.status: # if SCF summary file is not in the list of retrieved files, SCF terminated illy