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

AssembleCcdTask failure with Python 2

    XMLWordPrintable

    Details

    • Story Points:
      0.5
    • Epic Link:
    • Sprint:
      Alert Production S17 - 2
    • Team:
      Alert Production

      Description

      E.g. when running ip_isr's examples/runAssembleTask.py:

      Traceback (most recent call last):
        File "runAssembleTask.py", line 36, in <module>
          runAssembler()
        File "runAssembleTask.py", line 21, in runAssembler
          assembledExposure = assembleTask.assembleCcd(assemblyInput)
        File "/scratch/swinbank/ip_isr/python/lsst/ip/isr/assembleCcdTask.py", line 200, in assembleCcd
          ccd = next(assembleInput.values()).getDetector()
      TypeError: list object is not an iterator
      

      Looks like a bad conversion to Python 3: it assumes that dict.values() returns an iterator, but in Python 2 it returns a list. Simple (but ugly) fix:

      --- a/python/lsst/ip/isr/assembleCcdTask.py
      +++ b/python/lsst/ip/isr/assembleCcdTask.py
      @@ -197,7 +197,7 @@ class AssembleCcdTask(pipeBase.Task):
               ccd = None
               if hasattr(assembleInput, "has_key"):
                   # Get a detector object for this set of amps
      -            ccd = next(assembleInput.values()).getDetector()
      +            ccd = next(iter(assembleInput.values())).getDetector()
                   # Sent a dictionary of input exposures, assume one amp per key keyed on amp name
       
                   def getNextExposure(amp):
      

      Better suggestions welcome.

      Rather shocking that this wasn't caught by tests. Sufficiently shocking that I'm wondering if I missed something. I suggest that rather than just committing the above tweak, this ticket should include a test which demonstrates that the task actually runs. An easy way to do that might be to simply migrate a slightly modified version of the code from examples/ to tests/.

        Attachments

          Issue Links

            Activity

            swinbank John Swinbank created issue -
            swinbank John Swinbank made changes -
            Field Original Value New Value
            Component/s ip_isr [ 10730 ]
            tjenness Tim Jenness made changes -
            Watchers John Swinbank, Mandeep Gill, Simon Krughoff [ John Swinbank, Mandeep Gill, Simon Krughoff ] John Parejko, John Swinbank, Mandeep Gill, Simon Krughoff [ John Parejko, John Swinbank, Mandeep Gill, Simon Krughoff ]
            mfisherlevine Merlin Fisher-Levine made changes -
            Link This issue blocks DM-8403 [ DM-8403 ]
            swinbank John Swinbank made changes -
            Link This issue relates to DM-8284 [ DM-8284 ]
            swinbank John Swinbank made changes -
            Link This issue blocks DM-8403 [ DM-8403 ]
            rowen Russell Owen made changes -
            Assignee Russell Owen [ rowen ]
            rowen Russell Owen made changes -
            Epic Link DM-8472 [ 28104 ]
            rowen Russell Owen made changes -
            Sprint Alert Production S17 - 2 [ 361 ]
            Labels SciencePipelines
            rowen Russell Owen made changes -
            Story Points 1 0.5
            rowen Russell Owen made changes -
            Reviewers Merlin Fisher-Levine [ mfisherlevine ]
            Status To Do [ 10001 ] In Review [ 10004 ]
            swinbank John Swinbank made changes -
            Link This issue is duplicated by DM-9370 [ DM-9370 ]
            swinbank John Swinbank made changes -
            Link This issue relates to DM-9374 [ DM-9374 ]
            mfisherlevine Merlin Fisher-Levine made changes -
            Status In Review [ 10004 ] Reviewed [ 10101 ]
            rowen Russell Owen made changes -
            Resolution Done [ 10000 ]
            Status Reviewed [ 10101 ] Done [ 10002 ]

              People

              Assignee:
              rowen Russell Owen
              Reporter:
              swinbank John Swinbank
              Reviewers:
              Merlin Fisher-Levine
              Watchers:
              John Parejko, John Swinbank, Mandeep Gill [X] (Inactive), Merlin Fisher-Levine, Russell Owen, Simon Krughoff, Tim Jenness
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  CI Builds

                  No builds found.