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

            No builds found.
            tjenness Tim Jenness created issue -
            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.

            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.
            tjenness Tim Jenness made changes -
            Field Original Value New Value
            Status To Do [ 10001 ] In Progress [ 3 ]
            tjenness Tim Jenness added a comment - - edited

            jbosch 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

            tjenness Tim Jenness added a comment - - edited jbosch 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
            tjenness Tim Jenness made changes -
            Reviewers Jim Bosch [ jbosch ]
            Status In Progress [ 3 ] In Review [ 10004 ]
            tjenness Tim Jenness added a comment -

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

            tjenness Tim Jenness added a comment - Also I see afw PR is missing: https://github.com/lsst/afw/pull/705
            tjenness Tim Jenness made changes -
            Component/s afw [ 10714 ]
            Component/s obs_subaru [ 10747 ]
            Component/s pipe_base [ 10727 ]
            Component/s resources [ 19925 ]
            tjenness Tim Jenness made changes -
            Component/s ip_isr [ 10730 ]
            tjenness Tim Jenness made changes -
            Component/s ap_association [ 14501 ]
            Component/s shapelet [ 11310 ]
            tjenness Tim Jenness made changes -
            Labels gen3-middleware
            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.

            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.
            jbosch Jim Bosch made changes -
            Status In Review [ 10004 ] Reviewed [ 10101 ]
            tjenness Tim Jenness made changes -
            Resolution Done [ 10000 ]
            Status Reviewed [ 10101 ] Done [ 10002 ]
            tjenness Tim Jenness made changes -
            Link This issue is duplicated by DM-39972 [ DM-39972 ]

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Jenkins

                  No builds found.