Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-28555: Add verbosity to ApPipe and DiaPipe DB errors #72

Merged
merged 1 commit into from
Mar 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 13 additions & 19 deletions python/lsst/ap/pipe/ap_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

import warnings

from sqlalchemy.exc import OperationalError, ProgrammingError

import lsst.pex.config as pexConfig
import lsst.pipe.base as pipeBase

Expand Down Expand Up @@ -169,23 +167,19 @@ def runDataRef(self, rawRef, templateIds=None, reuse=None):
else:
diffImResults = self.runDiffIm(calexpRef, templateIds)

try:
if "diaPipe" in reuse:
warnings.warn(
"Reusing association results for some images while rerunning "
"others may change the associations. If exact reproducibility "
"matters, please clear the association database and run "
"ap_pipe.py with --reuse-output-from=differencer to redo all "
"association results consistently.")
if "diaPipe" in reuse and calexpRef.datasetExists("apdb_marker", write=True):
message = "DiaPipeline has already been run for {0}, skipping...".format(calexpRef.dataId)
self.log.info(message)
diaPipeResults = None
else:
diaPipeResults = self.runAssociation(calexpRef)
except (OperationalError, ProgrammingError) as e:
# Don't use lsst.pipe.base.TaskError because it mixes poorly with exception chaining
raise RuntimeError("Database query failed; did you call make_apdb.py first?") from e
if "diaPipe" in reuse:
warnings.warn(
"Reusing association results for some images while rerunning "
"others may change the associations. If exact reproducibility "
"matters, please clear the association database and run "
"ap_pipe.py with --reuse-output-from=differencer to redo all "
"association results consistently.")
if "diaPipe" in reuse and calexpRef.datasetExists("apdb_marker", write=True):
message = "DiaPipeline has already been run for {0}, skipping...".format(calexpRef.dataId)
self.log.info(message)
diaPipeResults = None
else:
diaPipeResults = self.runAssociation(calexpRef)

return pipeBase.Struct(
l1Database=self.diaPipe.apdb,
Expand Down