Skip to content

Make coupled-dataset path handling work for cloud and local stores#1363

Draft
jpdunc23 wants to merge 1 commit into
mainfrom
feature/coupled-datasets-cloud-paths
Draft

Make coupled-dataset path handling work for cloud and local stores#1363
jpdunc23 wants to merge 1 commit into
mainfrom
feature/coupled-datasets-cloud-paths

Conversation

@jpdunc23

Copy link
Copy Markdown
Member

The coupled-dataset creation script assumed local filesystem paths: existence checks on output zarrs and stats directories, and the output writer's overwrite guard, used os.path, which silently misbehaves on gs:// URLs. This meant multi-terabyte production stores had to be mirrored to a local volume before coupled processing could run. Path-existence decisions now resolve the filesystem from the URL scheme via a shared fsspec helper, so cloud and local stores share one code path; the staged compute-or-read-existing behavior, debug mode, and subsample mode are unchanged on local paths.

Changes:

  • scripts/data_process/fs_utils.py (new): path_exists, is_dir, makedirs, is_local helpers resolving the filesystem from the URL scheme via fsspec.core.url_to_fs

  • scripts/data_process/create_coupled_datasets.py: all path-existence checks (output stores, stats dirs, merged-stats dirs, ensemble category dirs) go through path_exists

  • scripts/data_process/writer_utils.py: OutputWriterConfig.write's overwrite/initialize guard uses the scheme-aware is_dir, accepting gs:// output stores

  • scripts/data_process/get_stats.py, scripts/data_process/merge_stats.py: hardcoded gs: prefix checks and local-only os.makedirs replaced with the shared helpers

  • New end-to-end test running CoupledDatasetsConfig.write_datasets_and_stats on tiny synthetic zarrs: staged outputs and merged stats produced, re-runs resume on existing outputs without recomputing, debug mode writes nothing

  • Tests added

  • If dependencies changed, "deps only" image rebuilt and "latest_deps_only_image.txt" file updated

Path-existence decisions in create_coupled_datasets.py, the xpartition
output writer, get_stats.py, and merge_stats.py now resolve the
filesystem from the URL scheme via a shared fsspec helper (fs_utils.py),
so gs:// inputs/outputs and local paths share one code path. Adds an
end-to-end test of write_datasets_and_stats on synthetic zarrs covering
staged outputs, resume-on-existing, and debug mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant