From 1cacee61e968fd18e1e94ca9db3ca46d1d9c4f6a Mon Sep 17 00:00:00 2001 From: TerrenceMcGuinness-NOAA Date: Mon, 30 Oct 2023 15:22:45 +0000 Subject: [PATCH 1/5] feature of excluding cases in CI when specified to do so in yaml file --- workflow/create_experiment.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/workflow/create_experiment.py b/workflow/create_experiment.py index c343f1d798..5260f61b7c 100755 --- a/workflow/create_experiment.py +++ b/workflow/create_experiment.py @@ -18,6 +18,7 @@ """ import os +import sys from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter from pathlib import Path @@ -27,6 +28,8 @@ import setup_expt import setup_xml +from hosts import Host + _here = os.path.dirname(__file__) _top = os.path.abspath(os.path.join(os.path.abspath(_here), '..')) @@ -69,12 +72,18 @@ def input_args(): if __name__ == '__main__': user_inputs = input_args() - + # Create a dictionary to pass to parse_j2yaml for parsing the yaml file data = AttrDict(HOMEgfs=_top) data.update(os.environ) testconf = parse_j2yaml(path=user_inputs.yaml, data=data) + if 'exclude' in testconf: + host = Host() + if host.machine.lower() in testconf.exclude: + logger.info(f'Skipping creation of case: {testconf.arguments.pslot} on {host.machine.capitalize()}') + sys.exit(0) + # Create a list of arguments to setup_expt.py setup_expt_args = [testconf.experiment.system, testconf.experiment.mode] for kk, vv in testconf.arguments.items(): From ee1882e5e4b1de69f6a99b6447a5730374a5ddfe Mon Sep 17 00:00:00 2001 From: TerrenceMcGuinness-NOAA Date: Mon, 30 Oct 2023 19:38:52 +0000 Subject: [PATCH 2/5] removed spaces in line 75 of create experiment --- workflow/create_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/create_experiment.py b/workflow/create_experiment.py index 5260f61b7c..deef0ef08f 100755 --- a/workflow/create_experiment.py +++ b/workflow/create_experiment.py @@ -72,7 +72,7 @@ def input_args(): if __name__ == '__main__': user_inputs = input_args() - + # Create a dictionary to pass to parse_j2yaml for parsing the yaml file data = AttrDict(HOMEgfs=_top) data.update(os.environ) From 31983c4755db3b865b9372a58a139254199e3469 Mon Sep 17 00:00:00 2001 From: TerrenceMcGuinness-NOAA Date: Tue, 31 Oct 2023 09:42:45 -0400 Subject: [PATCH 3/5] Update workflow/create_experiment.py Co-authored-by: Walter Kolczynski - NOAA --- workflow/create_experiment.py | 1 - 1 file changed, 1 deletion(-) diff --git a/workflow/create_experiment.py b/workflow/create_experiment.py index deef0ef08f..eaab7e531b 100755 --- a/workflow/create_experiment.py +++ b/workflow/create_experiment.py @@ -30,7 +30,6 @@ from hosts import Host - _here = os.path.dirname(__file__) _top = os.path.abspath(os.path.join(os.path.abspath(_here), '..')) From 97c86d715ae0f5345297db8a2f93c43e49f5085f Mon Sep 17 00:00:00 2001 From: TerrenceMcGuinness-NOAA Date: Tue, 31 Oct 2023 09:43:07 -0400 Subject: [PATCH 4/5] Update workflow/create_experiment.py Co-authored-by: Walter Kolczynski - NOAA --- workflow/create_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/create_experiment.py b/workflow/create_experiment.py index eaab7e531b..c69b452a39 100755 --- a/workflow/create_experiment.py +++ b/workflow/create_experiment.py @@ -79,7 +79,7 @@ def input_args(): if 'exclude' in testconf: host = Host() - if host.machine.lower() in testconf.exclude: + if host.machine.lower() in [ excluded_host.lower() for excluded_host in testconf.exclude ]: logger.info(f'Skipping creation of case: {testconf.arguments.pslot} on {host.machine.capitalize()}') sys.exit(0) From 87a6865720fde05f5de189e68155987fb5bf501f Mon Sep 17 00:00:00 2001 From: TerrenceMcGuinness-NOAA Date: Tue, 31 Oct 2023 09:47:46 -0400 Subject: [PATCH 5/5] Update create_experiment.py linter doesn't like spaces --- workflow/create_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/create_experiment.py b/workflow/create_experiment.py index c69b452a39..3a5d21aadf 100755 --- a/workflow/create_experiment.py +++ b/workflow/create_experiment.py @@ -79,7 +79,7 @@ def input_args(): if 'exclude' in testconf: host = Host() - if host.machine.lower() in [ excluded_host.lower() for excluded_host in testconf.exclude ]: + if host.machine.lower() in [excluded_host.lower() for excluded_host in testconf.exclude]: logger.info(f'Skipping creation of case: {testconf.arguments.pslot} on {host.machine.capitalize()}') sys.exit(0)