LSST Applications  21.0.0-1-g8760c09+64c1bc5aa5,21.0.0-1-ga51b5d4+5491f2a448,21.0.0-12-gbc0a1a5+358ec59a0b,21.0.0-16-gec61338+5610ae7019,21.0.0-17-g535a0ce+68fccf98ea,21.0.0-17-g712f02f+45471446cb,21.0.0-17-gd94932e+2079490dd7,21.0.0-18-g7027a3f+4cbab02c09,21.0.0-2-g103fe59+06c026c8ca,21.0.0-2-g45278ab+64c1bc5aa5,21.0.0-2-g5242d73+6960a99322,21.0.0-2-g7f82c8f+67f3a3c28a,21.0.0-2-ga326454+67f3a3c28a,21.0.0-2-gde069b7+4f46bdaea8,21.0.0-2-gecfae73+2147fbf537,21.0.0-2-gfc62afb+6960a99322,21.0.0-20-gddd4cb5+65cad37c35,21.0.0-23-gd55139e+1c650b9db3,21.0.0-23-gdb5a2aa5+0812f74ba3,21.0.0-3-g357aad2+4d30138d3a,21.0.0-3-g4a4ce7f+6960a99322,21.0.0-3-g4be5c26+6960a99322,21.0.0-3-gd7ab7aa+fdc5edd43f,21.0.0-3-ge02ed75+68fccf98ea,21.0.0-35-g4939cbb3d+fb0e51fe34,21.0.0-4-g591bb35+68fccf98ea,21.0.0-4-g65b4814+65cad37c35,21.0.0-4-g7dab645+661e67791c,21.0.0-4-ge8a399c+f93516e5e6,21.0.0-5-g8c1d971+7b9a448d34,21.0.0-5-gcc89fd6+fdc5edd43f,21.0.0-5-gd00fb1e+d528b983c0,21.0.0-6-g0bf7090+18535a8d22,21.0.0-6-gc675373+6960a99322,21.0.0-7-gdf92d54+64c1bc5aa5,21.0.0-8-g5674e7b+8087abed30,21.0.0-85-g296c1d01+374697a2d0,master-gac4afde19b+68fccf98ea,w.2021.20
LSST Data Management Base Package
Functions | Variables
lsst.pipe.base.makeLightWeightButler Namespace Reference

Functions

None buildLightweightButler (Butler butler, QuantumGraph graph, str outputLocation, str run, *bool clobber=False, Optional[Callable[[Butler], Butler]] butlerModifier=None, Optional[Iterable[str]] collections=None)
 

Variables

 DataSetTypeMap = Mapping[DatasetType, Set[DataCoordinate]]
 

Function Documentation

◆ buildLightweightButler()

None lsst.pipe.base.makeLightWeightButler.buildLightweightButler ( Butler  butler,
QuantumGraph  graph,
str  outputLocation,
str  run,
*bool   clobber = False,
Optional[Callable[[Butler], Butler]]   butlerModifier = None,
Optional[Iterable[str]]   collections = None 
)
buildLightweightButler is a function that is responsible for exporting
input `QuantumGraphs` into a new minimal `~lsst.daf.butler.Butler` which
only contains datasets specified by the `QuantumGraph`. These datasets are
both those that already exist in the input `~lsst.daf.butler.Butler`, and
those that are expected to be produced during the execution of the
`QuantumGraph`.

Parameters
----------
butler : `lsst.daf.butler.Bulter`
    This is the existing `~lsst.daf.butler.Butler` instance from which
    existing datasets will be exported. This should be the
    `~lsst.daf.butler.Butler` which was used to create any `QuantumGraphs`
    that will be converted with this object.
graph : `QuantumGraph`
    Graph containing nodes that are to be exported into a lightweight
    butler
outputLocation : `str`
    Location at which the lightweight butler is to be exported
run : `str`
    The run collection that the exported datasets are to be placed in.
clobber : `bool`, Optional
    By default a butler will not be created if a file or directory
    already exists at the output location. If this is set to `True`
    what is at the location will be deleted prior to running the
    export. Defaults to `False`
butlerModifier : `~typing.Callable`, Optional
    If supplied this should be a callable that accepts a
    `~lsst.daf.butler.Butler`, and returns an instantiated
    `~lsst.daf.butler.Butler`. This callable may be used to make any
    modifications to the `~lsst.daf.butler.Butler` desired. This
    will be called after importing all datasets that exist in the input
    `~lsst.daf.butler.Butler` but prior to inserting Datasets expected
    to be produced. Examples of what this method could do include
    things such as creating collections/runs/ etc.
collections : `~typing.Iterable` of `str`, Optional
    An iterable of collection names that will be exported from the input
    `~lsst.daf.butler.Butler` when creating the lightweight butler. If not
    supplied the `~lsst.daf.butler.Butler`\ 's `~lsst.daf.butler.Registry`
    default collections will be used.

Raises
------
FileExistsError
    Raise if something exists in the filesystem at the specified output
    location and clobber is `False`

Definition at line 180 of file makeLightWeightButler.py.

188  ) -> None:
189  r"""buildLightweightButler is a function that is responsible for exporting
190  input `QuantumGraphs` into a new minimal `~lsst.daf.butler.Butler` which
191  only contains datasets specified by the `QuantumGraph`. These datasets are
192  both those that already exist in the input `~lsst.daf.butler.Butler`, and
193  those that are expected to be produced during the execution of the
194  `QuantumGraph`.
195 
196  Parameters
197  ----------
198  butler : `lsst.daf.butler.Bulter`
199  This is the existing `~lsst.daf.butler.Butler` instance from which
200  existing datasets will be exported. This should be the
201  `~lsst.daf.butler.Butler` which was used to create any `QuantumGraphs`
202  that will be converted with this object.
203  graph : `QuantumGraph`
204  Graph containing nodes that are to be exported into a lightweight
205  butler
206  outputLocation : `str`
207  Location at which the lightweight butler is to be exported
208  run : `str`
209  The run collection that the exported datasets are to be placed in.
210  clobber : `bool`, Optional
211  By default a butler will not be created if a file or directory
212  already exists at the output location. If this is set to `True`
213  what is at the location will be deleted prior to running the
214  export. Defaults to `False`
215  butlerModifier : `~typing.Callable`, Optional
216  If supplied this should be a callable that accepts a
217  `~lsst.daf.butler.Butler`, and returns an instantiated
218  `~lsst.daf.butler.Butler`. This callable may be used to make any
219  modifications to the `~lsst.daf.butler.Butler` desired. This
220  will be called after importing all datasets that exist in the input
221  `~lsst.daf.butler.Butler` but prior to inserting Datasets expected
222  to be produced. Examples of what this method could do include
223  things such as creating collections/runs/ etc.
224  collections : `~typing.Iterable` of `str`, Optional
225  An iterable of collection names that will be exported from the input
226  `~lsst.daf.butler.Butler` when creating the lightweight butler. If not
227  supplied the `~lsst.daf.butler.Butler`\ 's `~lsst.daf.butler.Registry`
228  default collections will be used.
229 
230  Raises
231  ------
232  FileExistsError
233  Raise if something exists in the filesystem at the specified output
234  location and clobber is `False`
235  """
236  # Do this first to Fail Fast if the output exists
237  if (dirExists := os.path.exists(outputLocation)) and not clobber:
238  raise FileExistsError("Cannot create a butler at specified location, location exists")
239 
240  exports, inserts = _accumulate(graph)
241  yamlBuffer = _export(butler, collections, exports)
242 
243  newButler = _setupNewButler(butler, outputLocation, dirExists)
244 
245  newButler = _import(yamlBuffer, newButler, inserts, run, butlerModifier)
246  newButler._config.dumpToUri(f"{outputLocation}/butler.yaml")

Variable Documentation

◆ DataSetTypeMap

lsst.pipe.base.makeLightWeightButler.DataSetTypeMap = Mapping[DatasetType, Set[DataCoordinate]]

Definition at line 40 of file makeLightWeightButler.py.