Skip to content

Commit

Permalink
fixup! WIP: reworking along TJ's lines
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulPrice committed Jul 12, 2022
1 parent 654c361 commit b3aa8d2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions python/lsst/pipe/base/executionButlerBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def _setupNewButler(
butler: Butler,
outputLocation: ResourcePath,
dirExists: bool,
datastoreRoot: Optional[str] = None,
datastoreRoot: Optional[ResourcePath] = None,
) -> Butler:
"""Set up the execution butler
Expand All @@ -243,7 +243,7 @@ def _setupNewButler(
Location of the execution butler.
dirExists : `bool`
Does the ``outputLocation`` exist, and if so, should it be clobbered?
datastoreRoot : `str`, optional
datastoreRoot : `ResourcePath`, optional
Path for the execution butler datastore. If not specified, then the
original butler's datastore will be used.
Expand Down Expand Up @@ -277,7 +277,7 @@ def _setupNewButler(
# record the current root of the datastore if it is specified relative
# to the butler root
if datastoreRoot is not None:
config["datastore", "root"] = datastoreRoot
config["datastore", "root"] = datastoreRoot.geturl()
elif config.get(("datastore", "root")) == BUTLER_ROOT_TAG and butler._config.configDir is not None:
config["datastore", "root"] = butler._config.configDir.geturl()
config["datastore", "trust_get_request"] = True
Expand Down Expand Up @@ -351,7 +351,7 @@ def buildExecutionButler(
clobber: bool = False,
butlerModifier: Optional[Callable[[Butler], Butler]] = None,
collections: Optional[Iterable[str]] = None,
datastore_root: Optional[str] = None,
datastore_root: Optional[ResourcePathExpression] = None,
transfer: str = "auto",
) -> Butler:
r"""buildExecutionButler is a function that is responsible for exporting
Expand Down Expand Up @@ -396,7 +396,7 @@ def buildExecutionButler(
`~lsst.daf.butler.Butler` when creating the execution butler. If not
supplied the `~lsst.daf.butler.Butler`\ 's `~lsst.daf.butler.Registry`
default collections will be used.
datastore_root : `str`, Optional
datastore_root : convertible to `ResourcePath`, Optional
Root directory for datastore of execution butler. If `None`, then the
original butler's datastore will be used.
transfer : `str`
Expand All @@ -419,6 +419,8 @@ def buildExecutionButler(
"""
# We know this must refer to a directory.
outputLocation = ResourcePath(outputLocation, forceDirectory=True)
if datastore_root is not None:
datastore_root = ResourcePath(datastore_root, forceDirectory=True)

# Do this first to Fail Fast if the output exists
if (dirExists := outputLocation.exists()) and not clobber:
Expand Down

0 comments on commit b3aa8d2

Please sign in to comment.