Make EventActor.run (and its subclasses) more efficient#210
Merged
Conversation
…_run is set False during the __init__
…figure_before_run()
rocco8773
marked this pull request as ready for review
July 22, 2026 01:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a
Motorinstance was initialized it was executing_configure_before_run()up to 8 times. If the motor is not reachable, this causes a long delay before control is given back to the user. This is then compounded when a run configuration has multiple motors.To mitigate this behavior,
EventActor.runis updated with aforce_runkeyword argument. This keyword is not explicitly used byEventActor.runbut is intended forEventActorsub-classes to utilized. By defaultforce_run is True, which means whenever.run()is executed it will try to fully run or restart the actor. By settingforce_runtoFalse(which is done during the__init__of sub-classes) the actor will can respect certain designed flags to abort a run or restart. For example, theMotoractor will NOT try to restart (or run) whenMotor.connectedisFalseandforce_runisFalse.What has changed?
force_run(Default:True) is added toEventActor.run.force_runis setFalseinEventActor.__init__.Motor.runis updated to respect theforce_runkeyword, and NOT run ifMotor.connectedisFalsewhenforce_run=False.force_runis setFalseinMotor.__init__.Motor._configure_before_run()is immediately returned if not connected after attemptingself.connect().Axis.runis updated to respect theforce_runkeyword.Axisitself does NOT have a flag to abort running / restarting.force_runis setFalseinAxis.__init__.Axis.__init__and intoAxis._configure_before_runso the motor actor is NOT spawned multiple times during instantiation.Drive.runis updated to respect theforce_runkeyword.Driveitself does NOT have a flag to abort running / restarting.force_runis setFalseinDrive.__init__.MotionGroup.runis updated to respect theforce_runkeyword.MotionGroupitself does NOT have a flag to abort running / restarting.force_runis setFalseinMotionGroup.__init__.RunManager.runis updated to respect theforce_runkeyword.RunManageritself does NOT have a flag to abort running / restarting.force_runis setFalseinRunManager.__init__.RunManager.runremoved the if-clause that prevent a terminatedMotionGroupfrom being restarted.