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

_filename functions return first mappable repository even when file does not exist

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Story Points:
      4
    • Team:
      Data Access and Database

      Description

      In the snippet:

          import os
       
          dataPath = os.path.join("/datasets", "hsc", "repo", "rerun",
                                  "private", "hchiang2", "RC", "DM-10084-mosaic")
       
          butler = dafPersist.Butler(dataPath)
       
          dataId = dict(tract=8766, patch='2,1', filter='HSC-I')
       
          coadd = butler.get("deepCoadd_calexp", dataId)
       
          ci = coadd.getInfo().getCoaddInputs()
       
          for ccd in ci.ccds:
              fn = butler.get("calexp_filename", dataId, visit=ccd["visit"], ccd=ccd["ccd"])[0]
              print ccd["visit"], ccd["ccd"], fn, os.path.exists(fn), butler.get("calexp", dataId, visit=ccd["visit"], ccd=ccd["ccd"]).getDimensions()
              break
      

      Returns:

          7304 8 /datasets/hsc/repo/rerun/private/hchiang2/RC/DM-10084-mosaic/00995/HSC-I/corr/CORR-0007304-008.fits False (2048, 4176)
      

      In the case of a get (where write=False) the Butler should not be returning a path to a file that does not exist, it should look in parent repositories until an existing file is found, or return something meaning "file not found".

      This seems to be an issue related to how bypass functions work. I think it’s because there’s no consideration for write=True or False in the filename bypass function (as there normally is for `map`ping), and so the map_xyz_filename function returns the first location its able to map (which would be appropriate for a `put` where write=True but is not appropriate for a get where write=False).

        Attachments

          Activity

          Hide
          npease Nate Pease [X] (Inactive) added a comment -

          FWIW composites are tested in obs_base, see https://github.com/lsst/obs_base/blob/master/tests/test_composite.py

          Show
          npease Nate Pease [X] (Inactive) added a comment - FWIW composites are tested in obs_base, see  https://github.com/lsst/obs_base/blob/master/tests/test_composite.py
          Hide
          erykoff Eli Rykoff added a comment -

          A-ha, thanks. Should I add a test there as well?

          Show
          erykoff Eli Rykoff added a comment - A-ha, thanks. Should I add a test there as well?
          Hide
          npease Nate Pease [X] (Inactive) added a comment -

          It looks ok to me. FWIW I think it's worth being explicit somewhere/somehow that you're not trying to support composite datasets here (otherwise I think folks may come asking about that).

          Show
          npease Nate Pease [X] (Inactive) added a comment - It looks ok to me. FWIW I think it's worth being explicit somewhere/somehow that you're not trying to support composite datasets here (otherwise I think folks may come asking about that).
          Hide
          npease Nate Pease [X] (Inactive) added a comment -

          I missed your reply asking about adding a test. If you want to support composites I think that will be more work. I think it's a conversation you should have with stakeholders (which is not me at this point) about if the effort is worthwhile now, or maybe wait & see. 

          Show
          npease Nate Pease [X] (Inactive) added a comment - I missed your reply asking about adding a test. If you want to support composites I think that will be more work. I think it's a conversation you should have with stakeholders (which is not me at this point) about if the effort is worthwhile now, or maybe wait & see. 
          Hide
          erykoff Eli Rykoff added a comment -

          Implemented getUri(), which solves the problem that led to this ticket without changing the current functionality of _filename.

          Show
          erykoff Eli Rykoff added a comment - Implemented getUri(), which solves the problem that led to this ticket without changing the current functionality of _filename.

            People

            Assignee:
            erykoff Eli Rykoff
            Reporter:
            npease Nate Pease [X] (Inactive)
            Reviewers:
            Nate Pease [X] (Inactive)
            Watchers:
            Eli Rykoff, John Parejko, Kian-Tat Lim, Nate Pease [X] (Inactive), Paul Price
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Jenkins

                No builds found.