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-37634: Update logBrowser to take ready-made butler #16

Merged
merged 6 commits into from
Jan 19, 2023
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
26 changes: 14 additions & 12 deletions python/lsst/summit/extras/logUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@

import logging
import math
import lsst.summit.utils.butlerUtils as butlerUtils

__all__ = ["LogBrowser",
]
__all__ = ["LogBrowser"]

_LOG = logging.getLogger(__name__)


class LogBrowser():
class LogBrowser:
"""A convenience class for helping identify different failure modes within
a processing collection.

mfisherlevine marked this conversation as resolved.
Show resolved Hide resolved
Parameters
----------
butler : `lsst.daf.butler.Butler`
The butler. Must contain the collection to be examined.
taskName : `str`
The name of the task, e.g. ``isr``, ``characterizeImage``, etc.
collection : `str`
Expand All @@ -44,12 +44,13 @@ class LogBrowser():
-----
Many tasks throw errors with values in them, meaning the ``doFailZoology``
function doesn't collapse them down to a single failure case as one would
like. If this is the case, the first part of the message that is common
amongst the ones you would like to be classed together, and add it to the
class property ``SPECIAL_ZOO_CASES`` to declare a new type of error animal.
like. If this is the case, take the first part of the message that is
common among the ones you would like to be classed together, and add it to
the class property ``SPECIAL_ZOO_CASES`` to declare a new type of error
animal.

example usage:

Choose a reason for hiding this comment

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

You can put this into its own Numpydoc section, i.e.:

Examples
--------

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason I didn't want to do that is that sometimes those are actually considered literally runnable, and this one certainly isn't and could not really ever be, realistically, given the need for a butler and a collection.

Choose a reason for hiding this comment

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

Fair enough - in which case, as it is looks good!

logBrowser = LogBrowser(taskName=taskName, collection=collection)
logBrowser = LogBrowser(butler, taskName, collection)
fail = 'TaskError: Fatal astrometry failure detected: mean on-sky distance'
logBrowser.SPECIAL_ZOO_CASES.append(fail)
logBrowser.doFailZoology()
Expand All @@ -58,15 +59,16 @@ class property ``SPECIAL_ZOO_CASES`` to declare a new type of error animal.
# butler.datastores is verbose by default and not interesting to most
'lsst.daf.butler.datastores',
]
SPECIAL_ZOO_CASES = ['with gufunc signature (n?,k),(k,m?)->(n?,m?)',
]
SPECIAL_ZOO_CASES = [
'with gufunc signature (n?,k),(k,m?)->(n?,m?)',
]
Comment on lines +62 to +64

Choose a reason for hiding this comment

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

PS - I think my comment may have been lost in the noise, but you can wrap this onto one line if you wish (the trailing comma led me to put it as above, but one line works just fine).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There will almost certainly be new things added to that, so the one-line-per-item thing should fit better in the long run here, I think.


def __init__(self, taskName, collection):
def __init__(self, butler, taskName, collection):
self.taskName = taskName
self.collection = collection

self.log = _LOG.getChild("logBrowser")
self.butler = butlerUtils.makeDefaultLatissButler(extraCollections=[collection])
self.butler = butler

self.dataRefs = self._getDataRefs()
self.logs = self._loadLogs(self.dataRefs)
Expand Down