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

cmd-line tasks should log the command being executed

    XMLWordPrintable

    Details

      Description

      When a command-line task is executed it would be very helpful to have the command logged. This helps diagnose issues with packages such as ci_hsc and validate_drp.

      This is trivial when the task is executed from the command line, e.g. add the following to ArgumentParser:

      log.info("Running: {}".format(" ".join(sys.arvg)))
      

      It is a bit trickier if the command is executed by code that calls CmdLineTask.parseAndRun directly; the arguments are readily available but determining the task will require introspection.

        Attachments

          Activity

          Hide
          rowen Russell Owen added a comment -

          Do you have time to look at this Hsin-Fang Chiang? It's a fairly small change, though includes a new function in lsst.utils along with a unit test.

          Try running some of the tests in pipe_base manually, or validate_drp demos or ci_hsc to see the new log message.

          Show
          rowen Russell Owen added a comment - Do you have time to look at this Hsin-Fang Chiang ? It's a fairly small change, though includes a new function in lsst.utils along with a unit test. Try running some of the tests in pipe_base manually, or validate_drp demos or ci_hsc to see the new log message.
          Hide
          rowen Russell Owen added a comment -

          Implemented by adding get_caller_name to lsst.utils (with a unit test) and tweaking ArgumentParser.parse_args to call it.

          I used numpydoc formatting to document the new function.

          Show
          rowen Russell Owen added a comment - Implemented by adding get_caller_name to lsst.utils (with a unit test) and tweaking ArgumentParser.parse_args to call it. I used numpydoc formatting to document the new function.
          Hide
          hchiang2 Hsin-Fang Chiang added a comment -

          Looks fine to me. This seems something SuperTask/Activator may improve, but before that, this is helpful indeed!

          Show
          hchiang2 Hsin-Fang Chiang added a comment - Looks fine to me. This seems something SuperTask/Activator may improve, but before that, this is helpful indeed!
          Hide
          rowen Russell Owen added a comment -

          Thank you for the helpful review. As per your suggestion I made all log statements use deferred formatting in pipe_base.

          Show
          rowen Russell Owen added a comment - Thank you for the helpful review. As per your suggestion I made all log statements use deferred formatting in pipe_base.

            People

            Assignee:
            rowen Russell Owen
            Reporter:
            rowen Russell Owen
            Reviewers:
            Hsin-Fang Chiang
            Watchers:
            Hsin-Fang Chiang, Paul Price, Russell Owen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Jenkins

                No builds found.