Skip to content
Snippets Groups Projects

Fix #1949 process on_stop call sequence for macros without checkpoint

Following on what has been discussed in #1949 (closed)

This specific case was with the mv macro, but applies to any macro that does not contain checkpoints (mAPI). In that cases the current macro is stopped but the propagation is not handled properly as the StopException is not being raised (since it is done in the mAPI decorator).

Now, after adding the macro_obj.checkPoint call in MacroExecutor.runMacro and running the following test macro as described in the issue:

class test_regression_create_macro_mvr(Macro):
    """
    The main macro on_stop is not called but only when the loop is
finished.
    This is a regression.
    """
    def run(self):
        m, _ = self.createMacro("mvr", [["dmot01", 100]])
        for i in range(10):
            self.info(f"Point: {i}")
            self.runMacro(m)
            self.checkPoint()
    
    def on_stop(self):
        self.info("parent macro on_stop called")

The abort is stopping the macro loop and the on_stop of the parent is called

Door_macroserver_1 (READY) [102]: %test_regression_create_macro_mvr
Point: 0
Point: 1
^C
Ctrl-C received: Stopping...
Stopping Motion(['dmot01']) reserved by mv
Motion(['dmot01']) stopped
Executing mv.on_stop method...
Executing mvr.on_stop method...
Executing test_regression_create_macro_mvr.on_stop method...
parent macro on_stop called
Stopping done!

Door_macroserver_1 (READY) [103]: 

Merge request reports

Pipeline #1284876578 passed

Pipeline passed for ae7ca4a3 on ovallcorba:issue1949_on_stop_regression

Deployed to Docs‎-dev‎ May 9, 2024

Merged by Zbigniew ReszelaZbigniew Reszela May 10, 2024 (May 10, 2024 10:31am UTC)

Loading

Pipeline #1285825128 passed

Pipeline passed for 2d69d921 on develop

Deployed to Docs‎-dev‎ May 10, 2024

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading