Coverage for python / lsst / obs / lsst / script / _ingest_guider.py: 70%
10 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-05-06 09:01 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-05-06 09:01 +0000
1# This file is part of obs_lsst.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (http://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
22from __future__ import annotations
24__all__ = ["ingest_guider_simple"]
26import logging
28from lsst.daf.butler import Butler
30from .._ingest_guider import ingest_guider
32_LOG = logging.getLogger(__name__)
35def ingest_guider_simple(
36 repo: str,
37 locations: list[str],
38 regex: str,
39 output_run: str,
40 transfer: str = "direct",
41 track_file_attrs: bool = True,
42 fail_fast: bool = False,
43 register_dataset_types: bool = False,
44) -> None:
45 """Ingests guider data into the butler registry.
47 Parameters
48 ----------
49 repo : `str`
50 URI to the repository.
51 locations : `list` [`str`]
52 Files to ingest and directories to search for files that match
53 ``regex`` to ingest.
54 regex : `str`
55 Regex string used to find files in directories listed in locations.
56 output_run : `str`
57 The RUN collection where datasets should be ingested.
58 transfer : `str` or None
59 The external data transfer type, by default "direct". In "direct"
60 mode an attempt to re-ingest the same file will not fail.
61 track_file_attrs : `bool`, optional
62 Control whether file attributes such as the size or checksum should
63 be tracked by the datastore. Whether this parameter is honored
64 depends on the specific datastore implementation.
65 fail_fast : `bool`, optional.
66 If `True`, ingest is stopped as soon as any error is encountered.
67 register_dataset_types : `bool`, optional
68 Whether to try to register the guider dataset type.
69 """
70 with Butler.from_config(repo, writeable=True) as butler:
72 refs = ingest_guider(
73 butler,
74 locations,
75 file_filter=regex,
76 transfer=transfer,
77 run=output_run,
78 track_file_attrs=track_file_attrs,
79 register_dataset_type=register_dataset_types,
80 fail_fast=fail_fast,
81 )
83 _LOG.info("Ingested %d guider file%s", len(refs), "" if len(refs) == 1 else "s")