Commit b0890392 authored by Willi Rath's avatar Willi Rath

Prepare for lists of cera data sets

parent 51600f18
......@@ -281,8 +281,9 @@ class JblobCred(Renderer):
prefix : str
Full path to the directory that should contain the downloaded data in
the end.
cera_data_set : str
Cera-dataset acronym. Example: 'ERA40_SFC06_MM_EWSS'
cera_data_sets : list
List of cera-dataset acronyms. Example: ['ERA40_SFC06_MM_EWSS',
'ERA40_SFC06_MM_NSSS']
username_var : str
Variable name in the credential file to hold the user name.
password_var : str
......@@ -304,12 +305,27 @@ class JblobCred(Renderer):
de.dkrz.cera.applications.JblobClient \\
--username "${{{username_var}}}" \\
--password "${{{password_var}}}" \\
--dataset {cera_data_set} \\
--dataset {cera_data_sets_string} \\
--dir {prefix}
rm -rf "${{jblob_tmp_dir}}"
""")
def __init__(self, yaml_dict=None, *args, **kwargs):
"""Construct `cera_data_sets_string`."""
if "cera_data_sets" not in yaml_dict:
yaml_dict["cera_data_sets_string"] = ""
else:
yaml_dict["cera_data_sets_string"] = (
" ".join(
'"{}"'.format(Path(ald) / "**")
for cds in yaml_dict["cera_data_sets"]
)
)
super(JblobCred, self).__init__(yaml_dict=yaml_dict, *args,
**kwargs)
class PreProcessing(Renderer):
"""Add all lines from the `pre_processing` field."""
......
......@@ -58,7 +58,8 @@ def test_wget_recursive_cred_rendering():
def test_jblob_cred_rendering():
yaml_dict = {"prefix": "pref", "cera_data_set": "example_ds",
yaml_dict = {"prefix": "pref", "cera_data_sets": ["example_ds_01",
"example_ds_02"],
"username_var": "ASDF_USER", "password_var": "ASDF_PWD"}
target_string = textwrap.dedent("""\
jblob_tmp_dir=$(mktemp -d)
......@@ -74,7 +75,7 @@ def test_jblob_cred_rendering():
de.dkrz.cera.applications.JblobClient \\
--username "${ASDF_USER}" \\
--password "${ASDF_PWD}" \\
--dataset example_ds \\
--dataset example_ds_01 example_ds_02 \\
--dir pref
rm -rf "${jblob_tmp_dir}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment