Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-27033: Integration branch for butler schema changes #90

Merged
merged 9 commits into from
Nov 4, 2020
15 changes: 2 additions & 13 deletions python/lsst/ctrl/mpexec/cli/opt/optionGroups.py
Expand Up @@ -24,9 +24,7 @@
"qgraph_options")


from functools import partial

from lsst.daf.butler.cli.utils import option_section, split_kv, unwrap
from lsst.daf.butler.cli.utils import option_section, unwrap
import lsst.obs.base.cli.opt as obsBaseOpts
import lsst.daf.butler.cli.opt as dafButlerOpts
from . import options as ctrlMpExecOpts
Expand Down Expand Up @@ -88,16 +86,7 @@ def __init__(self):
self.decorators = [
option_section(sectionText="Data repository and selection options:"),
ctrlMpExecOpts.butler_config_option(),
# CLI API says `--input` values should be given like
# "datasetType:collectionName" or just "datasetType", but CmdLineFwk api
# wants input values to be a tuple of tuples, where each tuple is
# ("collectionName", "datasetType"), or (..., "datasetType") with elipsis if no
# collectionName is provided. Setting `return_type=tuple`, `reverse_kv=True`,
# and `default_key=...` make `split_kv` callback structure its return value
# that way.
ctrlMpExecOpts.input_option(callback=partial(split_kv, return_type=tuple, default_key=...,
reverse_kv=True, unseparated_okay=True),
multiple=True),
ctrlMpExecOpts.input_option(),
ctrlMpExecOpts.output_option(),
ctrlMpExecOpts.output_run_option(),
ctrlMpExecOpts.extend_run_option(),
Expand Down
10 changes: 2 additions & 8 deletions python/lsst/ctrl/mpexec/cli/opt/options.py
Expand Up @@ -68,17 +68,11 @@
is_flag=True)


# TODO defaultMetavar and defaultHelp both match with the handling
# specified by the input_option callback defined in commands.py. Should
# that callback definition get moved here? Should these defaults be made
# less use-case specific and moved to commands.py? Is it ok as is?
input_option = MWOptionDecorator("-i", "--input",
callback=split_commas,
default=list(),
help=unwrap("""Comma-separated names of the input collection(s). Entries may
include a colon (:), the first string is a dataset type name that
restricts the search in that collection."""),
metavar="COLL,DSTYPE:COLL",
help=unwrap("""Comma-separated names of the input collection(s)."""),
metavar="COLLECTION",
multiple=True)

no_versions_option = MWOptionDecorator("--no-versions",
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ctrl/mpexec/cmdLineFwk.py
Expand Up @@ -350,7 +350,7 @@ def makeWriteButler(cls, args: argparse.Namespace) -> Butler:
if self.output is not None:
chainDefinition = list(self.output.chain if self.output.exists else self.inputs)
if args.replace_run:
replaced, _ = chainDefinition.pop(0)
replaced = chainDefinition.pop(0)
if args.prune_replaced == "unstore":
# Remove datasets from datastore
with butler.transaction():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cmdLineFwk.py
Expand Up @@ -95,7 +95,7 @@ def makeSQLiteRegistry(create=True):
config = RegistryConfig()
config["db"] = uri
if create:
Registry.fromConfig(config, create=True)
Registry.createFromConfig(config)
yield config


Expand Down