Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-40032

Extend find_outside_stacklevel API

    XMLWordPrintable

    Details

      Description

      In DM-39996 we had a situation where we have a warning deep in a hierarchy but we want the message to appear to come from outside middleware.

      This ticket will:

      • Add *args support so that multiple packages can be specified.
      • Add support for classes that should be filtered out.

      The latter will allow a warning from a formatter to be issued from the task runQuantum method (since in theory a pipeline task can use the default runQuantum in pipe_base) or the user's Butler.get method since we could skip QuantumContext API calls.

        Attachments

          Issue Links

            Activity

            Hide
            tjenness Tim Jenness added a comment -

            Additional example: There is a warning in resources S3 handle that should come from user code but find_outside_stacklevel needs to be able to jump past the backoff wrapper.

            Show
            tjenness Tim Jenness added a comment - Additional example: There is a warning in resources S3 handle that should come from user code but find_outside_stacklevel needs to be able to jump past the backoff wrapper.
            Hide
            tjenness Tim Jenness added a comment - - edited

            Jim Bosch would you mind taking a look at this please? The main code change is in utils but my main reason for asking you to look is that I've tried to fix all the packages that were using warnings.warn without a stacklevel and in some cases I changed them to logging or removed the deprecated code completely.

            The two places that use the new functionality that triggered this ticket are resources and obs_base.

            Note that there is a pipe_base change that is not visible on the sidebar: https://github.com/lsst/pipe_base/pull/360

            Show
            tjenness Tim Jenness added a comment - - edited Jim Bosch would you mind taking a look at this please? The main code change is in utils but my main reason for asking you to look is that I've tried to fix all the packages that were using warnings.warn without a stacklevel and in some cases I changed them to logging or removed the deprecated code completely. The two places that use the new functionality that triggered this ticket are resources and obs_base. Note that there is a pipe_base change that is not visible on the sidebar: https://github.com/lsst/pipe_base/pull/360
            Hide
            tjenness Tim Jenness added a comment -

            Also I see afw PR is missing: https://github.com/lsst/afw/pull/705

            Show
            tjenness Tim Jenness added a comment - Also I see afw PR is missing: https://github.com/lsst/afw/pull/705
            Hide
            jbosch Jim Bosch added a comment -

            All looks good; no PR comments whatsoever.

            I did wonder a bit if some of the pipe_base warnings should also be passed through ctrl_mpexec, but I think the ctrl_mpexec code is pretty much only called from the command-line so it's a moot point.

            Show
            jbosch Jim Bosch added a comment - All looks good; no PR comments whatsoever. I did wonder a bit if some of the pipe_base warnings should also be passed through ctrl_mpexec, but I think the ctrl_mpexec code is pretty much only called from the command-line so it's a moot point.

              People

              Assignee:
              tjenness Tim Jenness
              Reporter:
              tjenness Tim Jenness
              Reviewers:
              Jim Bosch
              Watchers:
              Jim Bosch, Tim Jenness
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins

                  No builds found.