From ae6067ddb0d54019f193fdc165275a72309aaef2 Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Thu, 11 Jan 2024 09:23:47 -0700 Subject: [PATCH 1/3] Add --dry-run flag to transfer-from-graph command --- python/lsst/pipe/base/cli/cmd/commands.py | 3 +++ python/lsst/pipe/base/script/transfer_from_graph.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/python/lsst/pipe/base/cli/cmd/commands.py b/python/lsst/pipe/base/cli/cmd/commands.py index 39488f718..2db7fee13 100644 --- a/python/lsst/pipe/base/cli/cmd/commands.py +++ b/python/lsst/pipe/base/cli/cmd/commands.py @@ -55,6 +55,9 @@ def register_instrument(*args: Any, **kwargs: Any) -> None: @register_dataset_types_option() @transfer_dimensions_option(default=False) @update_output_chain_option() +@click.option( + "--dry-run", is_flag=True, default=False, help="Run the transfer but do not update the destination butler" +) @options_file_option() def transfer_from_graph(**kwargs: Any) -> None: """Transfer datasets from a quantum graph to a destination butler. diff --git a/python/lsst/pipe/base/script/transfer_from_graph.py b/python/lsst/pipe/base/script/transfer_from_graph.py index 07fc5fd4e..68b672400 100644 --- a/python/lsst/pipe/base/script/transfer_from_graph.py +++ b/python/lsst/pipe/base/script/transfer_from_graph.py @@ -38,6 +38,7 @@ def transfer_from_graph( register_dataset_types: bool, transfer_dimensions: bool, update_output_chain: bool, + dry_run: bool, ) -> int: """Transfer output datasets from quantum graph to dest. @@ -57,6 +58,8 @@ def transfer_from_graph( If quantum graph metadata includes output run name and output collection which is a chain, update the chain definition to include run name as a the first collection in the chain. + dry_run : `bool` + Run the transfer without updating the destination butler. Returns ------- @@ -106,6 +109,7 @@ def transfer_from_graph( transfer="auto", register_dataset_types=register_dataset_types, transfer_dimensions=transfer_dimensions, + dry_run=dry_run, ) count = len(transferred) From 522b8471fb2c8b14c90b9edf8a62b9d82697ca66 Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Tue, 16 Jan 2024 13:20:52 -0700 Subject: [PATCH 2/3] Add the butler subcommand yaml file to packaging --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f7ca41193..6c68e1abd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,7 +54,7 @@ zip-safe = true license-files = ["COPYRIGHT", "LICENSE", "bsd_license.txt", "gpl-v3.0.txt"] [tool.setuptools.package-data] -"lsst.pipe.base" = ["py.typed"] +"lsst.pipe.base" = ["py.typed", "cli/resources.yaml"] [tool.setuptools.dynamic] version = { attr = "lsst_versions.get_lsst_version" } From 95407f9a76c4cea39a66e0e1a21fea3d70983784 Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Thu, 18 Jan 2024 09:01:20 -0700 Subject: [PATCH 3/3] Add news fragment --- doc/changes/DM-42306.feature.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changes/DM-42306.feature.rst diff --git a/doc/changes/DM-42306.feature.rst b/doc/changes/DM-42306.feature.rst new file mode 100644 index 000000000..52561e2b2 --- /dev/null +++ b/doc/changes/DM-42306.feature.rst @@ -0,0 +1 @@ +The ``butler transfer-from-graph`` command now supports a ``--dry-run`` option to allow the transfer to run without updating the target butler.