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

Add async method for handling new summary state to BaseCsc

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: ts_auxiliary_telescope
    • Labels:
      None
    • Story Points:
      1
    • Sprint:
      TSSW Sprint - Sep 16 - Sep 28
    • Team:
      Telescope and Site

      Description

      Add an asynchronous method to BaseCsc that is called when the summary state changes, e.g. handle_summary_state. This will be the new preferred way to handle changes to summary state (leaving report_summary_state to just report the new state) and the base class will do nothing, so CSCs will not have to call super().handle_summary_state(...)

      This may be a bit tricky because it needs to be called whenever report_summary_state is called, and that is called from two synchronous functions: fault and the summary_state setter. The following might work:

      • Have fault start handle_summary_state but not wait for it to finish
      • Deprecate the summary_state setter and stop using it in salobj. Just set self._summary_state directly when necessary rather than add a new synchronous public method. CSCs should not set this value.
      • Have the summary_state setter start handle_summary_state but not wait for it to finish. I don't see much choice.
      • When setting summary_state internally as part of a normal state transition call handle_summary_state before report_summary_state, so if something goes wrong one can go directly to fault state without claiming to have gone into the desired state (since the CSC never actually makes it to the new state).
      • If report_summary_state or handle_summary_state raises an exception go into fault state. Ideally the CSC would already have faulted, so this is merely a fallback. This requires error codes to not be globally unique.

        Attachments

          Issue Links

            Activity

            Hide
            rowen Russell Owen added a comment - - edited

            I also added a new BaseCsc property disabled_or_enable since we perform that test so often.

            I also took the liberty of adding angle_diff and assertAnglesAlmostEqual functions because I have needed these in several CSCs (including ATDome and ATDomeTrajectory) and felt it's best to have them in one place. I copied the code and tests from ATDomeTrajectory.

            Pull request: https://github.com/lsst-ts/ts_salobj/pull/63

            Show
            rowen Russell Owen added a comment - - edited I also added a new BaseCsc property disabled_or_enable since we perform that test so often. I also took the liberty of adding angle_diff and assertAnglesAlmostEqual functions because I have needed these in several CSCs (including ATDome and ATDomeTrajectory) and felt it's best to have them in one place. I copied the code and tests from ATDomeTrajectory. Pull request: https://github.com/lsst-ts/ts_salobj/pull/63
            Hide
            rowen Russell Owen added a comment -

            If you have time I would appreciate your review of this.

            Show
            rowen Russell Owen added a comment - If you have time I would appreciate your review of this.
            Hide
            mareuter Michael Reuter added a comment -

            See PR for comments, but looks fine to me.

            Show
            mareuter Michael Reuter added a comment - See PR for comments, but looks fine to me.
            Hide
            rowen Russell Owen added a comment -

            Merged to develop

            Show
            rowen Russell Owen added a comment - Merged to develop

              People

              Assignee:
              rowen Russell Owen
              Reporter:
              rowen Russell Owen
              Reviewers:
              Michael Reuter
              Watchers:
              Michael Reuter, Russell Owen
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins Builds

                  No builds found.