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-31801: Use lsst prefix for loggers #143

Merged
merged 2 commits into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 4 additions & 2 deletions python/lsst/ap/verify/ap_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
from .pipeline_driver import ApPipeParser, runApPipeGen2, runApPipeGen3
from .workspace import WorkspaceGen2, WorkspaceGen3

_LOG = lsst.log.Log.getLogger(__name__)


class _InputOutputParser(argparse.ArgumentParser):
"""An argument parser for program-wide input and output.
Expand Down Expand Up @@ -188,7 +190,7 @@ def runApVerify(cmdLine=None):
or 127 if the task runner framework failed.
"""
lsst.log.configure()
timj marked this conversation as resolved.
Show resolved Hide resolved
log = lsst.log.Log.getLogger('ap.verify.ap_verify.main')
log = _LOG.getChild('main')
# TODO: what is LSST's policy on exceptions escaping into main()?
args = _ApVerifyParser().parse_args(args=cmdLine)
log.debug('Command-line arguments: %s', args)
Expand Down Expand Up @@ -245,7 +247,7 @@ def runIngestion(cmdLine=None):
Python code. If `None`, `sys.argv` will be used.
"""
lsst.log.configure()
log = lsst.log.Log.getLogger('ap.verify.ap_verify.ingest')
log = _LOG.getChild('ingest')
# TODO: what is LSST's policy on exceptions escaping into main()?
args = _IngestOnlyParser().parse_args(args=cmdLine)
log.debug('Command-line arguments: %s', args)
Expand Down
6 changes: 4 additions & 2 deletions python/lsst/ap/verify/ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
from lsst.pipe.tasks.ingestCalibs import IngestCalibsTask
from lsst.pipe.tasks.ingestCuratedCalibs import IngestCuratedCalibsTask

_LOG = lsst.log.Log.getLogger(__name__)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this boilerplate in every module? I'm a bit suspicious of global variables...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where else would you put it? We use this form all the time in middleware.



class DatasetIngestConfig(pexConfig.Config):
"""Settings and defaults for `DatasetIngestTask`.
Expand Down Expand Up @@ -615,7 +617,7 @@ def ingestDataset(dataset, workspace):
``obs`` package).
"""
# TODO: generalize to support arbitrary URIs (DM-11482)
log = lsst.log.Log.getLogger("ap.verify.ingestion.ingestDataset")
log = _LOG.getChild("ingestDataset")

ingester = DatasetIngestTask(config=_getConfig(DatasetIngestTask, dataset))
ingester.run(dataset, workspace)
Expand All @@ -637,7 +639,7 @@ def ingestDatasetGen3(dataset, workspace, processes=1):
processes : `int`
The number processes to use to ingest.
"""
log = lsst.log.Log.getLogger("ap.verify.ingestion.ingestDataset")
log = _LOG.getChild("ingestDataset")

ingester = Gen3DatasetIngestTask(dataset, workspace, config=_getConfig(Gen3DatasetIngestTask, dataset))
ingester.run(processes=processes)
Expand Down
6 changes: 4 additions & 2 deletions python/lsst/ap/verify/pipeline_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
import lsst.ap.pipe as apPipe
from lsst.ap.pipe.make_apdb import makeApdb

_LOG = lsst.log.Log.getLogger(__name__)


class ApPipeParser(argparse.ArgumentParser):
"""An argument parser for data needed by ``ap_pipe`` activities.
Expand Down Expand Up @@ -105,7 +107,7 @@ def runApPipeGen2(workspace, parsedCmdLine, processes=1):
``doReturnResults=False``. This object is valid even if
`~lsst.ap.pipe.ApPipeTask` was never run.
"""
log = lsst.log.Log.getLogger('ap.verify.pipeline_driver.runApPipeGen2')
log = _LOG.getChild('runApPipeGen2')

makeApdb(_getApdbArguments(workspace, parsedCmdLine))

Expand Down Expand Up @@ -158,7 +160,7 @@ def runApPipeGen3(workspace, parsedCmdLine, processes=1):
nonzero if there were errors. The exact meaning of nonzereo values
is an implementation detail.
"""
log = lsst.log.Log.getLogger('ap.verify.pipeline_driver.runApPipeGen3')
log = _LOG.getChild('runApPipeGen3')

makeApdb(_getApdbArguments(workspace, parsedCmdLine))

Expand Down