Skip to content

Commit

Permalink
Merge pull request #90 from lsst/tickets/DM-27033
Browse files Browse the repository at this point in the history
DM-27033: Integration branch for butler schema changes
  • Loading branch information
TallJimbo committed Nov 4, 2020
2 parents 43e4e0e + 2bf43cd commit 0eb9b17
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 23 deletions.
15 changes: 2 additions & 13 deletions python/lsst/ctrl/mpexec/cli/opt/optionGroups.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 0eb9b17

Please sign in to comment.