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

Fix connection deprecation warnings

    XMLWordPrintable

    Details

      Description

      In DM-40032 I modified the warnings in pipe_base so that the warning comes from the caller. Unfortunately this effectively broke the warning from deprecated connections because they are issued far away from any code that defines the warning itself.

      You end up with things like:

      drp_pipe/tests/test_pipelines.py:281: FutureWarning: Deprecated in favor of 'visitSummary'.  Will be removed after v26.
      

      since that is the first place outside of pipe_base. We need to decide what stacklevel to use but also ensure that the warning contains the name of the deprecated connection since otherwise people have no idea which connection they are being warned about.

        Attachments

          Activity

          Hide
          tjenness Tim Jenness added a comment -

          Adding the connection name is straightforward and you get:

          FutureWarning: finalVisitSummary: Deprecated in favor of 'visitSummary'.  Will be removed after v26.
          

          which is more information than we had before. What I really want to do is this:

          finalVisitSummary (from lsst.pipe.tasks.makeWarp.MakeWarpConnections): Deprecated in favor of 'visitSummary'.  Will be removed after v26.
          

          since it tells you exactly which class the deprecated connection came from. Calculating this for every connection has a lot of overhead (one test in drp_pipe gets 4 times slower) but I'd like to calculate the connection class for the deprecated connections. It would give some overhead but hopefully we don't have hundreds of deprecated connections. I haven't quite been able to get this working in post-init yet.

          Show
          tjenness Tim Jenness added a comment - Adding the connection name is straightforward and you get: FutureWarning: finalVisitSummary: Deprecated in favor of 'visitSummary'. Will be removed after v26. which is more information than we had before. What I really want to do is this: finalVisitSummary (from lsst.pipe.tasks.makeWarp.MakeWarpConnections): Deprecated in favor of 'visitSummary'. Will be removed after v26. since it tells you exactly which class the deprecated connection came from. Calculating this for every connection has a lot of overhead (one test in drp_pipe gets 4 times slower) but I'd like to calculate the connection class for the deprecated connections. It would give some overhead but hopefully we don't have hundreds of deprecated connections. I haven't quite been able to get this working in post-init yet.
          Hide
          tjenness Tim Jenness added a comment -

          Nate Lust can you please take a look at this.

          Because the connections are created in one place and we warn about deprecation in another, I need to calculate where the original deprecation comes from.

          The current message is:

          finalVisitSummary (from /Users/timj/work/lsstsw/stack/lsst-scipipe-7.0.0/Darwin/pipe_tasks/g85f8d04a89+f020c27613/python/lsst/pipe/tasks/makeWarp.py:121): Deprecated in favor of 'visitSummary'.  Will be removed after v26.
          

          Which is now useful and tells you exactly where the connection is being set.

          The downside is that the calls to inspect.stack() take some time because we call it for all deprecated connections even if we don't issue the warning message later on. In the drp_pipe tests we only issue a warning for finalVisitSummary and don't warn on the tens of other times where a deprecated connection is used. The drp_pipe tests (single process) change from 19s to 21s. Maybe that's fine for the increased visibility and the fact that most of these deprecations are going away in the next month.

          I haven't looked at the deprecatedTemplates deprecation to see how informative that message is.

          Show
          tjenness Tim Jenness added a comment - Nate Lust can you please take a look at this. Because the connections are created in one place and we warn about deprecation in another, I need to calculate where the original deprecation comes from. The current message is: finalVisitSummary (from /Users/timj/work/lsstsw/stack/lsst-scipipe-7.0.0/Darwin/pipe_tasks/g85f8d04a89+f020c27613/python/lsst/pipe/tasks/makeWarp.py:121): Deprecated in favor of 'visitSummary'. Will be removed after v26. Which is now useful and tells you exactly where the connection is being set. The downside is that the calls to inspect.stack() take some time because we call it for all deprecated connections even if we don't issue the warning message later on. In the drp_pipe tests we only issue a warning for finalVisitSummary and don't warn on the tens of other times where a deprecated connection is used. The drp_pipe tests (single process) change from 19s to 21s. Maybe that's fine for the increased visibility and the fact that most of these deprecations are going away in the next month. I haven't looked at the deprecatedTemplates deprecation to see how informative that message is.
          Hide
          nlust Nate Lust added a comment -

          Looks fine, minor comment

          Show
          nlust Nate Lust added a comment - Looks fine, minor comment

            People

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

              Dates

              Created:
              Updated:
              Resolved:

                Jenkins

                No builds found.