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

Simplify BaseTCS.ready_to_take_data and check all futures before setting them done

    XMLWordPrintable

Details

    • 1
    • TSSW Sprint - May 09 - May 23
    • Telescope and Site
    • No

    Description

      ts_observatory_control tries to set the result or exception of several asyncio.Futures, without first testing if they are done. That results in very confusing error messages if the Future is already done.

      Update the code to check first, e.g. change:

      self.done_task.set_result(None)
      

      to

      if not self.done_task.done():
          self.done_task.set_result(None)
      

      Also BaseTCS.ready_to_take_data is rather complicated in the way it handles tasks:

      • It is a sync method that returns a Task or Future, but there does not appear to be any need for this. Make it a normal async method instead.
      • It calls private implementation _ready_to_take_data and expects it to set a Future, but there's no need for that future (it basically duplicates an already existing task). It can just be a coroutine that returns when done or raises on error.

      (Note: I originally intended this ticket to focus on something else, but after implementing the above, tribeiro and I decided to split the rest off into a separate ticket: DM-34767)

      Attachments

        Issue Links

          Activity

            rowen Russell Owen added a comment - - edited Pull request: https://github.com/lsst-ts/ts_observatory_control/pull/64
            rowen Russell Owen added a comment -

            tribeiro reviewed this on github

            rowen Russell Owen added a comment - tribeiro reviewed this on github
            rowen Russell Owen added a comment -

            Merged to develop

            rowen Russell Owen added a comment - Merged to develop

            People

              rowen Russell Owen
              rowen Russell Owen
              Russell Owen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Jenkins

                  No builds found.