Skip to content

Commit

Permalink
Merge pull request #399 from lsst/tickets/DM-42306
Browse files Browse the repository at this point in the history
DM-42306: Support --dry-run flag in transfer-from-graph
  • Loading branch information
timj authored Jan 23, 2024
2 parents 5ae894a + 95407f9 commit a8697e8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/changes/DM-42306.feature.rst
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
3 changes: 3 additions & 0 deletions python/lsst/pipe/base/cli/cmd/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions python/lsst/pipe/base/script/transfer_from_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
-------
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit a8697e8

Please sign in to comment.