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

Brokenness when comparing configs with inheritance relationship

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: pex_config
    • Labels:
      None

      Description

      ...or just similar field names, I suppose. Viz:

      In [1]: import lsst.pex.config as pexConfig
       
      In [2]: class SuperConfig(pexConfig.Config):
         ...:     foo = pexConfig.Field(doc="test", dtype=str)
         ...: 
       
      In [3]: class SubConfig(SuperConfig):
         ...:     bar = pexConfig.Field(doc="test", dtype=str)
         ...: 
       
      In [4]: super_c, sub_c = SuperConfig(), SubConfig()
       
      In [5]: pexConfig.compareConfigs("", super_c, sub_c)
      Out[5]: True
       
      In [6]: pexConfig.compareConfigs("", sub_c, super_c)
      ---------------------------------------------------------------------------
      AttributeError                            Traceback (most recent call last)
      <ipython-input-7-e502e8e334d3> in <module>()
      ----> 1 pexConfig.compareConfigs("", sub_c, super_c)
       
      /software/lsstsw/stack_20181012/stack/miniconda3-4.5.4-fcd27eb/Linux64/pex_config/16.0-7-g9645df7+1/python/lsst/pex/config/comparison.py in compareConfigs(name, c1, c2, shortcut, rtol, atol, output)
          101     equal = True
          102     for field in c1._fields.values():
      --> 103         result = field._compare(c1, c2, shortcut=shortcut, rtol=rtol, atol=atol, output=output)
          104         if not result and shortcut:
          105             return False
       
      /software/lsstsw/stack_20181012/stack/miniconda3-4.5.4-fcd27eb/Linux64/pex_config/16.0-7-g9645df7+1/python/lsst/pex/config/config.py in _compare(self, instance1, instance2, shortcut, rtol, atol, output)
          356         """
          357         v1 = getattr(instance1, self.name)
      --> 358         v2 = getattr(instance2, self.name)
          359         name = getComparisonName(
          360             _joinNamePath(instance1._name, self.name),
       
      AttributeError: 'SuperConfig' object has no attribute 'bar'
      

      Both of these comparisons are mistakes: the configs aren't equal, so shouldn't return as if they are (in the first case), and the comparison should certainly not raise.

        Attachments

          Issue Links

            Activity

            Hide
            swinbank John Swinbank added a comment - - edited

            Meredith Rawls, this is causing the confusing error message we discussed last week. As a workaround, you can simply delete /project/mrawls/hits2014/coadds_dcr2/config/deep_makeCoaddTempExp.py (or probably running with --clobber-config will have the same effect).

            Show
            swinbank John Swinbank added a comment - - edited Meredith Rawls , this is causing the confusing error message we discussed last week. As a workaround, you can simply delete /project/mrawls/hits2014/coadds_dcr2/config/deep_makeCoaddTempExp.py (or probably running with --clobber-config will have the same effect).
            Hide
            swinbank John Swinbank added a comment - - edited

            Kian-Tat Lim — would you mind taking a quick look at this?

            Jenkins is here.

            Show
            swinbank John Swinbank added a comment - - edited Kian-Tat Lim — would you mind taking a quick look at this? Jenkins is here .
            Hide
            tjenness Tim Jenness added a comment -

            Looks good to me.

            Show
            tjenness Tim Jenness added a comment - Looks good to me.
            Hide
            swinbank John Swinbank added a comment -

            Thanks; merged.

            Show
            swinbank John Swinbank added a comment - Thanks; merged.

              People

              Assignee:
              swinbank John Swinbank
              Reporter:
              swinbank John Swinbank
              Reviewers:
              Kian-Tat Lim
              Watchers:
              John Swinbank, Kian-Tat Lim, Tim Jenness
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: