Skip to content

Issue #1009: Retrieve single dataset - #1047

Draft
Ed (mo-gill) wants to merge 12 commits into
v4.0_releasefrom
1009_cdds_retrieve_dataset_for_CREPP
Draft

Issue #1009: Retrieve single dataset#1047
Ed (mo-gill) wants to merge 12 commits into
v4.0_releasefrom
1009_cdds_retrieve_dataset_for_CREPP

Conversation

@mo-gill

@mo-gill Ed (mo-gill) commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Fulfils #1009

@mo-gill Ed (mo-gill) added this to the CDDS v4.0.2 milestone Aug 11, 2026
@mo-gill Ed (mo-gill) self-assigned this Aug 11, 2026
@mo-gill Ed (mo-gill) added the enhancement New feature or request label Aug 11, 2026
@mo-gill
Ed (mo-gill) changed the base branch from main to v4.0_release August 11, 2026 08:04
Comment thread cdds/cdds/common/mass.py
Comment on lines 237 to +251
@@ -246,9 +246,9 @@ def mass_list_files_recursively(mass_path, simulation):
'files': []
}
datasets[dataset_id]['files'].append({
'filesize': elems[4],
'filesize': elems[2],
'filename': filename,
'mass_path': elems[8]
'mass_path': elems[6]

@mo-gill Ed (mo-gill) Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The data retrieval tool appeared to be broken when i tested it at the start of this issue. It was throwing this error:

  File "CDDS/cdds/cdds/misc/retrieve_archived_data.py", line 333, in main_cdds_retrieve_archived_data
    mass_file_list = mass_list_files_recursively(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "CDDS/cdds/cdds/common/mass.py", line 238, in mass_list_files_recursively
    timestamp, filename) = elems[8].split('/')[-11:]
                           ~~~~~^^^
IndexError: list index out of range

I can only assume that the 'moo', 'ls', '-Rl' command used here now has slightly different stdout formatting after the move to new MASS.

This change fixes the error so the tool works again.

@mo-gill

Ed (mo-gill) commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

Undertook a rename of the cdds specific tool in this commit from cdds_retrieve_datato cdds_retrieve_archived_data to be a bit more specific as to its usage.

@mo-gill

Ed (mo-gill) commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

In this commit i created a replacement (called mass_list_files_recursively_with_checksums) very similar to mass_list_files_recursively which uses moo ls -Rlxm instead of moo ls -Rl, allowing the checksum to be retrieved from the returned xml.

I considered modifying mass_list_files_recursively instead, but walk_mass_dir uses that and seems reliant on it's current structure. The creation of an alternative function seemed like the safer solution (potentially walk_mass_dir could be refactored to use mass_list_files_recursively_with_checksums in future?)

I've dropped this new function as a replacement for mass_list_files_recursively that was being used in main_cdds_retrieve_archived_data and it seems to be working as expected.

@mo-gill
Ed (mo-gill) force-pushed the 1009_cdds_retrieve_dataset_for_CREPP branch from ae7a0a3 to 5c77cde Compare August 18, 2026 12:20
"dataset_id",
help="Full CMIP6 dataset_id, e.g. CMIP6.CMIP.MOHC.UKESM1-0-LL.piControl.r1i1p1f2.Amon.tas.gn",
)
if len(sys.argv) > 1 and sys.argv[1] == "get":

@mo-gill Ed (mo-gill) Aug 19, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This guards against IndexError when no command is supplied - provides helpful output instead:

$ cdds/bin/crepp_retrieve_archived_dataset get     
usage: crepp_retrieve_archived_dataset [-h] [--create-directories-false] [--mass-root MASS_ROOT]
                                       [--dry-run] [--chunk-size CHUNK_SIZE]
                                       {get,ls} dataset_id destination
crepp_retrieve_archived_dataset: error: the following arguments are required: dataset_id, destination

Arguably a bit brittle but the alternative was to use subparsers, which don't appear to be used elswhere in cdds - and they look a bit odd to me at first glance. So leaving this for ease of review unless that change is requested.

Comment thread cdds/cdds/common/mass.py
"""The :mod:`mass` module interact with the MASS archiving system."""
import logging
import subprocess
import re

@mo-gill Ed (mo-gill) Aug 20, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't appear to be used

Pylance: "re" is not accessed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant