From 5196726d6c38d8fcfee71cb57046208e56d564d7 Mon Sep 17 00:00:00 2001 From: Nadine Wieters Date: Thu, 3 Aug 2023 17:05:49 +0200 Subject: [PATCH 1/5] Reactivated the call of check_for_empty_components. --- src/esm_parser/yaml_to_dict.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/esm_parser/yaml_to_dict.py b/src/esm_parser/yaml_to_dict.py index 56faede97..b21baa84c 100644 --- a/src/esm_parser/yaml_to_dict.py +++ b/src/esm_parser/yaml_to_dict.py @@ -200,7 +200,7 @@ def yaml_file_to_dict(filepath): "add_export_vars" ] = add_export_vars # Check for empty components/models - # check_for_empty_components(yaml_load, filepath + extension) + check_for_empty_components(yaml_load, filepath + extension) return yaml_load except IOError as error: logger.debug( From 789ad406ba266e8c5a45e97b3692ed189f62ea1d Mon Sep 17 00:00:00 2001 From: Nadine Wieters Date: Fri, 18 Aug 2023 14:28:41 +0200 Subject: [PATCH 2/5] Improved error message for syntax error in runscript. --- src/esm_runscripts/config_initialization.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/esm_runscripts/config_initialization.py b/src/esm_runscripts/config_initialization.py index 7595e5515..80afc049d 100644 --- a/src/esm_runscripts/config_initialization.py +++ b/src/esm_runscripts/config_initialization.py @@ -94,7 +94,10 @@ def get_user_config_from_command_line(command_line_config): except SystemExit as sysexit: sys.exit(sysexit) except: - raise("An error occurred reading the config file from the command line") + esm_parser.user_error( + "Syntax error", + f"An error occurred while reading the config file " + f"``{command_line_config['runscript_abspath']}`` from the command line.") # NOTE(PG): I really really don't like this. But I also don't want to # re-introduce black/white lists From 04bd9dc510d118c7e100f7c5d96a71deac031643 Mon Sep 17 00:00:00 2001 From: Nadine Wieters Date: Fri, 18 Aug 2023 14:30:41 +0200 Subject: [PATCH 3/5] Set empty components in runscript to empty dictionary and give out a warning via user_note. --- src/esm_parser/esm_parser.py | 12 ++++++++++++ src/esm_parser/yaml_to_dict.py | 2 -- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/esm_parser/esm_parser.py b/src/esm_parser/esm_parser.py index a06bfe090..f74bcac53 100644 --- a/src/esm_parser/esm_parser.py +++ b/src/esm_parser/esm_parser.py @@ -262,11 +262,23 @@ def initialize_from_yaml(filepath): ) return user_config +def check_for_empty_components_in_user_config(user_config): + for model in list(user_config): + if user_config[model] is None or user_config[model] == "" or not user_config[model]: + user_note( + f"Warning: YAML syntax", + f"The component ``{model}`` in your configuration " + f"file ``{user_config['general']['runscript_abspath']}`` is empty. " + "No further variables are set for this component in your runscript." + ) + user_config[model] = {} + return user_config def complete_config(user_config): if not "general" in user_config: user_config["general"] = {} user_config["general"]["additional_files"] = [] + user_config = check_for_empty_components_in_user_config(user_config) while True: for model in list(user_config): diff --git a/src/esm_parser/yaml_to_dict.py b/src/esm_parser/yaml_to_dict.py index b21baa84c..36af45bc2 100644 --- a/src/esm_parser/yaml_to_dict.py +++ b/src/esm_parser/yaml_to_dict.py @@ -199,8 +199,6 @@ def yaml_file_to_dict(filepath): yaml_load["computer"]["runtime_environment_changes"][ "add_export_vars" ] = add_export_vars - # Check for empty components/models - check_for_empty_components(yaml_load, filepath + extension) return yaml_load except IOError as error: logger.debug( From 488c87f3a19d3f63184b74a174129ad7130e85bd Mon Sep 17 00:00:00 2001 From: Nadine Wieters Date: Fri, 18 Aug 2023 15:20:40 +0200 Subject: [PATCH 4/5] Empty components in user runscript will now be removed from user_config. --- src/esm_parser/esm_parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/esm_parser/esm_parser.py b/src/esm_parser/esm_parser.py index f74bcac53..956a2b4da 100644 --- a/src/esm_parser/esm_parser.py +++ b/src/esm_parser/esm_parser.py @@ -271,7 +271,7 @@ def check_for_empty_components_in_user_config(user_config): f"file ``{user_config['general']['runscript_abspath']}`` is empty. " "No further variables are set for this component in your runscript." ) - user_config[model] = {} + del user_config[model] return user_config def complete_config(user_config): From ecbcd6a7861c42cba646de50f16ab938b4c4008f Mon Sep 17 00:00:00 2001 From: BumpVersion Action Date: Mon, 28 Aug 2023 10:27:37 +0000 Subject: [PATCH 5/5] =?UTF-8?q?Bump=20version:=206.24.0=20=E2=86=92=206.24?= =?UTF-8?q?.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.cfg | 2 +- setup.py | 2 +- src/esm_archiving/__init__.py | 2 +- src/esm_calendar/__init__.py | 2 +- src/esm_cleanup/__init__.py | 2 +- src/esm_database/__init__.py | 2 +- src/esm_environment/__init__.py | 2 +- src/esm_master/__init__.py | 2 +- src/esm_motd/__init__.py | 2 +- src/esm_parser/__init__.py | 2 +- src/esm_plugin_manager/__init__.py | 2 +- src/esm_profile/__init__.py | 2 +- src/esm_runscripts/__init__.py | 2 +- src/esm_tests/__init__.py | 2 +- src/esm_tools/__init__.py | 2 +- src/esm_utilities/__init__.py | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/setup.cfg b/setup.cfg index 0c228f022..6f1d7669f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 6.24.0 +current_version = 6.24.1 commit = True tag = True diff --git a/setup.py b/setup.py index 2a99df9b8..5b59b2aa0 100644 --- a/setup.py +++ b/setup.py @@ -103,6 +103,6 @@ test_suite="tests", tests_require=test_requirements, url="https://github.com/esm-tools/esm_tools", - version="6.24.0", + version="6.24.1", zip_safe=False, ) diff --git a/src/esm_archiving/__init__.py b/src/esm_archiving/__init__.py index 6293bd272..fa3ef7dc3 100644 --- a/src/esm_archiving/__init__.py +++ b/src/esm_archiving/__init__.py @@ -4,7 +4,7 @@ __author__ = """Paul Gierz""" __email__ = "pgierz@awi.de" -__version__ = "6.24.0" +__version__ = "6.24.1" from .esm_archiving import (archive_mistral, check_tar_lists, delete_original_data, determine_datestamp_location, diff --git a/src/esm_calendar/__init__.py b/src/esm_calendar/__init__.py index 94c67905b..6550c088e 100644 --- a/src/esm_calendar/__init__.py +++ b/src/esm_calendar/__init__.py @@ -2,6 +2,6 @@ __author__ = """Dirk Barbi""" __email__ = "dirk.barbi@awi.de" -__version__ = "6.24.0" +__version__ = "6.24.1" from .esm_calendar import * diff --git a/src/esm_cleanup/__init__.py b/src/esm_cleanup/__init__.py index 533aead28..572aa2b0f 100644 --- a/src/esm_cleanup/__init__.py +++ b/src/esm_cleanup/__init__.py @@ -2,4 +2,4 @@ __author__ = """Dirk Barbi""" __email__ = "dirk.barbi@awi.de" -__version__ = "6.24.0" +__version__ = "6.24.1" diff --git a/src/esm_database/__init__.py b/src/esm_database/__init__.py index 2616c6107..30820bd57 100644 --- a/src/esm_database/__init__.py +++ b/src/esm_database/__init__.py @@ -2,4 +2,4 @@ __author__ = """Dirk Barbi""" __email__ = "dirk.barbi@awi.de" -__version__ = "6.24.0" +__version__ = "6.24.1" diff --git a/src/esm_environment/__init__.py b/src/esm_environment/__init__.py index 992494754..9e35d93d4 100644 --- a/src/esm_environment/__init__.py +++ b/src/esm_environment/__init__.py @@ -2,6 +2,6 @@ __author__ = """Dirk Barbi""" __email__ = "dirk.barbi@awi.de" -__version__ = "6.24.0" +__version__ = "6.24.1" from .esm_environment import * diff --git a/src/esm_master/__init__.py b/src/esm_master/__init__.py index 53450f87c..12f89bf9d 100644 --- a/src/esm_master/__init__.py +++ b/src/esm_master/__init__.py @@ -2,7 +2,7 @@ __author__ = """Dirk Barbi""" __email__ = "dirk.barbi@awi.de" -__version__ = "6.24.0" +__version__ = "6.24.1" from . import database diff --git a/src/esm_motd/__init__.py b/src/esm_motd/__init__.py index ccef34bbe..4861e6d18 100644 --- a/src/esm_motd/__init__.py +++ b/src/esm_motd/__init__.py @@ -2,6 +2,6 @@ __author__ = """Dirk Barbi""" __email__ = "dirk.barbi@awi.de" -__version__ = "6.24.0" +__version__ = "6.24.1" from .esm_motd import * diff --git a/src/esm_parser/__init__.py b/src/esm_parser/__init__.py index 60013b452..8ffab88b2 100644 --- a/src/esm_parser/__init__.py +++ b/src/esm_parser/__init__.py @@ -2,7 +2,7 @@ __author__ = """Dirk Barbi""" __email__ = "dirk.barbi@awi.de" -__version__ = "6.24.0" +__version__ = "6.24.1" from .esm_parser import * diff --git a/src/esm_plugin_manager/__init__.py b/src/esm_plugin_manager/__init__.py index 516986fc0..7dbbfe74d 100644 --- a/src/esm_plugin_manager/__init__.py +++ b/src/esm_plugin_manager/__init__.py @@ -2,6 +2,6 @@ __author__ = """Dirk Barbi, Paul Gierz, Sebastian Wahl""" __email__ = "dirk.barbi@awi.de" -__version__ = "6.24.0" +__version__ = "6.24.1" from .esm_plugin_manager import * diff --git a/src/esm_profile/__init__.py b/src/esm_profile/__init__.py index 2c119694c..f3491fccf 100644 --- a/src/esm_profile/__init__.py +++ b/src/esm_profile/__init__.py @@ -2,6 +2,6 @@ __author__ = """Dirk Barbi""" __email__ = "dirk.barbi@awi.de" -__version__ = "6.24.0" +__version__ = "6.24.1" from .esm_profile import * diff --git a/src/esm_runscripts/__init__.py b/src/esm_runscripts/__init__.py index b397b75f3..38d255d79 100644 --- a/src/esm_runscripts/__init__.py +++ b/src/esm_runscripts/__init__.py @@ -2,7 +2,7 @@ __author__ = """Dirk Barbi""" __email__ = "dirk.barbi@awi.de" -__version__ = "6.24.0" +__version__ = "6.24.1" from .batch_system import * from .chunky_parts import * diff --git a/src/esm_tests/__init__.py b/src/esm_tests/__init__.py index ecfa9142b..0795045a9 100644 --- a/src/esm_tests/__init__.py +++ b/src/esm_tests/__init__.py @@ -2,7 +2,7 @@ __author__ = """Miguel Andres-Martinez""" __email__ = "miguel.andres-martinez@awi.de" -__version__ = "6.24.0" +__version__ = "6.24.1" from .initialization import * from .read_shipped_data import * diff --git a/src/esm_tools/__init__.py b/src/esm_tools/__init__.py index dc8a9ce7f..74db7da65 100644 --- a/src/esm_tools/__init__.py +++ b/src/esm_tools/__init__.py @@ -23,7 +23,7 @@ __author__ = """Dirk Barbi, Paul Gierz""" __email__ = "dirk.barbi@awi.de" -__version__ = "6.24.0" +__version__ = "6.24.1" import functools import inspect diff --git a/src/esm_utilities/__init__.py b/src/esm_utilities/__init__.py index a9bff467a..123eb3580 100644 --- a/src/esm_utilities/__init__.py +++ b/src/esm_utilities/__init__.py @@ -2,6 +2,6 @@ __author__ = """Paul Gierz""" __email__ = "pgierz@awi.de" -__version__ = "6.24.0" +__version__ = "6.24.1" from .utils import *