API Change for Tasks. Renamed CmdLineTask.run -> runDataRef


(Yusra AlSayyad) #1

As part of the upcoming migration to PipelineTask f.k.a SuperTask, we are refactoring many of our Tasks. We are in the process of implementing RFC-352 which says that the default pipeBase.TaskRunner should call a task’s runDataRef method.

This change was implemented on DM-2639 and has been merged to master.

  • If you have code that calls a CmdLineTasks run method or primary core method (e.g. assemble, calibrate, runDetection) in a notebook or user script, you will likely have to rename any calls to the methods formerly known as run to runDataRef.

  • If you have your own CmdLineTask that no longer runs. (i.e. you see '*Task' object has no attribute 'runDataRef' you have two options:

  1. Rename your CmdlineTask's run method to runDataRef (preferred!) or

  2. Set your Task’s TaskRunner to lsst.pipe.base.LegacyTaskRunner by

    class MyTask(pipeBase.CmdLineTask):
    ConfigClass = MyConfig
    _DefaultName = “my”
    RunnerClass = lsst.pipe.base.LegacyTaskRunner

which will force pipeBase.parseAndRun() to call the old run instead of new runDataRef

NOTE: “DataRef” in runDataRef should not be taken literally as “one data ref.” The method accepts any Gen-2 Butler data products like the old run method did. The name DataRef in this context means Gen 2 Butler objects, e.g., a list of Butler.DataRefs, one Butler.DataRef, one Butler, etc… runDataRef is in contrast to the future runQuantum method which will take Gen 3 quantums:

  • DataRef = Gen 2
  • Quantum = Gen 3

Special thanks to @czw, who bravely took on a 16-package, API-breaking change as his first ticket on the project!

For more information see: API Change for Tasks. Rename run/<primaryMethod> to runDataRef/run, RFC-352, RFC-26