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

Add syntactic sugar for ConfigFields of *DatasetConfigs

    XMLWordPrintable

    Details

      Description

      As we discovered in the SuperTask conversion kickoff meeting, writing (e.g.)

      myInput = ConfigField(
          dtype=InputDatasetConfig,
          doc="Input image dataset type definition.",
          default=InputDatasetConfig(
              name="name",
              units=("Camera", "Visit", "Sensor"),
              storageClass="Exposure"
          )
      )

      is much too verbose.

      Add custom Field objects so the above can be written as

      myInput = InputDatasetField(
          doc="Input image dataset type definition.",
          name="name",
          units=("Camera", "Visit", "Sensor"),
          storageClass="Exposure")
      )

        Attachments

          Issue Links

            Activity

            Hide
            nlust Nate Lust added a comment -

            Jim Bosch asked me to knock this out quickly today as I have some time waiting on other tickets. Posting a comment here to make clear why I am stealing this ticket away and trigger alerts, in case there is some reason I should not take it.

            Show
            nlust Nate Lust added a comment - Jim Bosch asked me to knock this out quickly today as I have some time waiting on other tickets. Posting a comment here to make clear why I am stealing this ticket away and trigger alerts, in case there is some reason I should not take it.
            Hide
            tjenness Tim Jenness added a comment -

            Looks ok. I have one remaining comment regarding DataUnits looking confusingly like a class reference when it's talking about strings. Andy Salnikov wonders whether other helper routines could be added but that might be outside the scope of this ticket.

            Show
            tjenness Tim Jenness added a comment - Looks ok. I have one remaining comment regarding DataUnits looking confusingly like a class reference when it's talking about strings. Andy Salnikov wonders whether other helper routines could be added but that might be outside the scope of this ticket.
            Hide
            nlust Nate Lust added a comment -

            I had this exact discussion with Jim Bosch about DataUnits looking like a class. His judgement was that it is used many places within the super task world with that syntax that consistency was more important and not to worry about it. I am however happy to change it to data-type str.

            Show
            nlust Nate Lust added a comment - I had this exact discussion with Jim Bosch about DataUnits looking like a class. His judgement was that it is used many places within the super task world with that syntax that consistency was more important and not to worry about it. I am however happy to change it to data-type str.
            Hide
            jbosch Jim Bosch added a comment -

            To clarify, my proposal would be for a DataUnit name parameter to be documented as something like: 

            unit : `str`
                The name of the DataUnit this function wants.

            i.e.

             - The formal type is `str`, because it is.

             - We use DataUnit (one word, camel-case) to refer to a well-defined concept, but do not enclose it in backticks, because users of this API don't care about the daf_butler class (from their perspective, it's an implementation detail).  If we could make DataUnit link to a conceptual documentation page in the daf_butler docs in the future, that'd be lovely, but AFAIK that page does not exist (because those conceptual docs only exist in DMTNs right now).

             - We say "name" to make it extra clear we're talking about a string.

            Show
            jbosch Jim Bosch added a comment - To clarify, my proposal would be for a DataUnit name parameter to be documented as something like:  unit : `str` The name of the DataUnit this function wants. i.e.  - The formal type is `str` , because it is.  - We use DataUnit (one word, camel-case) to refer to a well-defined concept, but do not enclose it in backticks, because users of this API don't care about the daf_butler class (from their perspective, it's an implementation detail).  If we could make DataUnit link to a conceptual documentation page in the daf_butler docs in the future, that'd be lovely, but AFAIK that page does not exist (because those conceptual docs only exist in DMTNs right now).  - We say "name" to make it extra clear we're talking about a string.
            Hide
            nlust Nate Lust added a comment -

            Im putting this back in review, since there was a big change to support dynamically producing wrappers for all types of supertask config fields

            Show
            nlust Nate Lust added a comment - Im putting this back in review, since there was a big change to support dynamically producing wrappers for all types of supertask config fields
            Hide
            tjenness Tim Jenness added a comment -

            Looks good now.

            Show
            tjenness Tim Jenness added a comment - Looks good now.

              People

              Assignee:
              nlust Nate Lust
              Reporter:
              jbosch Jim Bosch
              Reviewers:
              Tim Jenness
              Watchers:
              Andy Salnikov, Jim Bosch, Nate Lust, Tim Jenness
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins

                  No builds found.