Skip to content

Commit

Permalink
Add progress reporting to DefineVisitsTask.
Browse files Browse the repository at this point in the history
  • Loading branch information
TallJimbo committed Mar 17, 2021
1 parent 71ba0fc commit 5d69766
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/lsst/obs/base/defineVisits.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
DataId,
DimensionGraph,
DimensionRecord,
Progress,
Timespan,
)

Expand Down Expand Up @@ -325,6 +326,7 @@ def __init__(self, config: Optional[DefineVisitsConfig] = None, *, butler: Butle
super().__init__(config, **kwargs)
self.butler = butler
self.universe = self.butler.registry.dimensions
self.progress = Progress("obs.base.RawIngestTask")
self.makeSubtask("groupExposures")
self.makeSubtask("computeVisitRegions", butler=self.butler)

Expand Down Expand Up @@ -545,7 +547,8 @@ def run(self, dataIds: Iterable[DataId], *,
zip(definitions, itertools.repeat(collections)))
# Iterate over visits and insert dimension data, one transaction per
# visit. If a visit already exists, we skip all other inserts.
for visitRecords in allRecords:
for visitRecords in self.progress.wrap(allRecords, total=len(definitions),
desc="Computing regions and inserting visits"):
with self.butler.registry.transaction():
if self.butler.registry.syncDimensionData("visit", visitRecords.visit):
self.butler.registry.insertDimensionData("visit_definition",
Expand Down

0 comments on commit 5d69766

Please sign in to comment.