Skip to content

Commit 6fd7280

Browse files
authored
Merge branch 'main' into 523-remove-environment-variables-from-create_request_filepy
2 parents 0e20e17 + c072882 commit 6fd7280

6 files changed

Lines changed: 9 additions & 189 deletions

File tree

CMEW/app/configure_for/bin/command_line.py

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# The LICENSE.md file contains full licensing details.
33
import argparse
44
from get_variables_from_recipe import get_variables_from_recipe
5-
from fetch_recipe import fetch_recipe
65
from update_recipe_file import update_recipe_file
76

87

@@ -58,70 +57,6 @@ def main_for_get_variables_from_recipe(arguments=None):
5857
get_variables_from_recipe(args.recipe_path, args.output_filepath)
5958

6059

61-
def parse_args_for_fetch_recipe(arguments):
62-
"""
63-
Return the names and values of the command line arguments for
64-
:func:`main_for_fetch_recipe`.
65-
66-
Parameters
67-
----------
68-
arguments : :obj:`list` of :obj:`str`
69-
The command line arguments to be parsed.
70-
71-
Returns
72-
-------
73-
:class:`argparse.Namespace`
74-
The names and values of the command line arguments.
75-
"""
76-
parser = argparse.ArgumentParser(
77-
description="Retrieve an ESMValTool recipe.",
78-
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
79-
)
80-
parser.add_argument(
81-
"--recipe_id",
82-
help=(
83-
"The short identifier of the recipe to retrieve, "
84-
"as written in the `flow.cylc` file."
85-
),
86-
)
87-
parser.add_argument(
88-
"--recipe_dict_fp",
89-
help=(
90-
"The filepath of the YAML file containing the "
91-
"name and location within esmvaltool.recipes "
92-
"of the recipe to be fetched."
93-
),
94-
)
95-
parser.add_argument(
96-
"--output_filepath",
97-
help=(
98-
"The full path to the where the "
99-
"ESMValTool recipe will be written."
100-
),
101-
)
102-
return parser.parse_args(arguments)
103-
104-
105-
def main_for_fetch_recipe(arguments=None):
106-
"""
107-
Retrieve an ESMValTool recipe.
108-
109-
Parameters
110-
----------
111-
arguments : :obj:`list` of :obj:`str`
112-
The command line arguments to be parsed.
113-
"""
114-
# Parse the arguments.
115-
args = parse_args_for_fetch_recipe(arguments)
116-
117-
# Run the code.
118-
print("Fetching recipe.")
119-
print(f"Recipe ID: {args.recipe_id}")
120-
print(f"Recipe dict filepath: {args.recipe_dict_fp}")
121-
print(f"Output filepath: {args.output_filepath}")
122-
fetch_recipe(args.recipe_id, args.recipe_dict_fp, args.output_filepath)
123-
124-
12560
def parse_args_for_update_recipe_file(arguments):
12661
"""
12762
Return the names and values of the command line arguments for

CMEW/app/configure_for/bin/fetch_recipe

Lines changed: 0 additions & 8 deletions
This file was deleted.

CMEW/app/configure_for/bin/fetch_recipe.py

Lines changed: 0 additions & 89 deletions
This file was deleted.

CMEW/app/configure_for/bin/test_fetch_recipe.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

CMEW/app/configure_for/rose-app.conf

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# (C) Crown Copyright 2024-2026, Met Office.
22
# The LICENSE.md file contains full licensing details.
3+
#
4+
# Select only the last match to avoid selecting any log messages
5+
# from 'cmew-esmvaltool-env' that may contain the recipe name,
6+
# e.g. from the 'run_name'.
37

48
[command]
59
default=set -euo pipefail
6-
=cmew-esmvaltool-env fetch_recipe \
7-
=--recipe_id $CYLC_TASK_PARAM_recipe \
8-
=--recipe_dict_fp $RECIPE_DICT_PATH \
9-
=--output_filepath $RECIPE_PATH
10+
=ESMVALTOOL_RECIPE_PATH=$(cmew-esmvaltool-env esmvaltool recipes list | grep $CYLC_TASK_PARAM_recipe | tail -n 1)
11+
=cmew-esmvaltool-env esmvaltool recipes get $ESMVALTOOL_RECIPE_PATH
12+
=mv $RECIPE_NAME $RECIPE_PATH
1013
=cmew-esmvaltool-env update_recipe_file \
1114
=--recipe_path $RECIPE_PATH \
1215
=--model_runs_yml_fp ${DATASETS_LIST_DIR}/model_runs.yml \

CMEW/flow.cylc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@
7777
[[RECIPE]]
7878
[[[environment]]]
7979
RECIPE_DICT_PATH = ${CYLC_WORKFLOW_RUN_DIR}/app/configure_for/etc/recipe_paths.yml
80-
RECIPE_PATH = "${CYLC_WORKFLOW_SHARE_DIR}/etc/recipe_${CYLC_TASK_PARAM_recipe}.yml"
80+
RECIPE_NAME = "recipe_${CYLC_TASK_PARAM_recipe}.yml"
81+
RECIPE_PATH = "${CYLC_WORKFLOW_SHARE_DIR}/etc/${RECIPE_NAME}"
8182
VARIABLES_LIST_DIR = ${CYLC_WORKFLOW_SHARE_DIR}/variables_lists
8283
RECIPE_VARIABLES_PATH = ${VARIABLES_LIST_DIR}/${CYLC_TASK_PARAM_recipe}_variables.txt
8384

0 commit comments

Comments
 (0)