From c4c265b317c6ea6a880c78c8e8c8807e6da7b5b6 Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Fri, 7 Jul 2023 13:58:42 -0700 Subject: [PATCH] Use new datastore roots API --- bin.src/ci_imsim_export_external_data.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin.src/ci_imsim_export_external_data.py b/bin.src/ci_imsim_export_external_data.py index 62cb1fe..5a799bd 100644 --- a/bin.src/ci_imsim_export_external_data.py +++ b/bin.src/ci_imsim_export_external_data.py @@ -49,14 +49,19 @@ ], ) + datastore_roots = butler.get_datastore_roots() + assert len(datastore_roots) == 1, "Export script requires a FileDatastore, not ChainedDatastore" + datastore_root = list(datastore_roots.values())[0] + assert datastore_root.schema == "file", "Export assumes POSIX datastore." + def rewrite(dataset: FileDataset) -> FileDataset: # Join the datastore root to the exported path. This should yield # absolute paths that start with $CI_IMSIM_DIR. - dataset.path = os.path.join(butler.datastore.root.ospath, dataset.path) + abspath = datastore_root.join(dataset.path) # Remove symlinks in the path; this should result in absolute paths # that start with $TESTDATA_CI_IMSIM_DIR, because ci_imsim always # symlinks these datasets from there. - dataset.path = os.path.realpath(dataset.path) + dataset.path = os.path.realpath(abspath.ospath) return dataset with butler.export(filename=args.filename) as export: