RunManager
- class bapsf_motion.actors.manager_.RunManager(config: str | Dict[str, Any] | RunManagerConfig | Path, *, auto_run: bool = False, build_mode: bool = False, parent: EventActor | None = None)
Bases:
EventActorAttributes Summary
Configuration dictionary of the actor.
The
Loggerinstance being used for the actor.The
asyncioevent loop for the actor.(
str) A unique name given for the instance of the actor.List of
asyncio.Tasks this actor has in its event loop.Indicates if the actor has been terminated.
The
Threadthe event loop is running in.Methods Summary
add_motion_group(config[, identifier])get_motion_group(identifier)pop_motion_group(identifier)remove_motion_group(identifier)run([auto_run])Activate the
asyncioevent loop.setup_event_loop([loop])Set up the
asyncioevent loop.terminate([delay_loop_stop])Stop the actor's event loop.
validate_motion_group(mg_config[, identifier])Attributes Documentation
- config
Configuration dictionary of the actor.
Warning
This dictionary should never be written to from outside the owning actor.
- is_moving
- logger
The
Loggerinstance being used for the actor.
- loop
The
asyncioevent loop for the actor.
- mgs
- name
(
str) A unique name given for the instance of the actor. This name is used as an identifier in the actor logger (seelogger).If the user does not specify a name, then the Actor should auto-generate a name.
- parent
- tasks
List of
asyncio.Tasks this actor has in its event loop.
- terminated
Indicates if the actor has been terminated.
- thread
The
Threadthe event loop is running in.If
loopwas given during instantiation, then there is no way of obtaining the thread object the event loop is running in. In this casethreadwill beNone.The thread id can always be retrieved using
_thread_id.
Methods Documentation
- add_motion_group(config: Dict[str, Any] | MotionGroupConfig | MotionGroup, identifier: str | int = None)
- run(auto_run=True)
Activate the
asyncioevent loop. If the event loop is running, then nothing happens. Otherwise, the event loop is placed in a separate thread and set torun_forever.
- setup_event_loop(loop: AbstractEventLoop | None = None)
Set up the
asyncioevent loop. If the given loop is not an instance ofAbstractEventLoop, then a new loop will be created.- Parameters:
loop (
asyncio.AbstractEventLoop) –asyncioevent loop for the actor’s tasks
- terminate(delay_loop_stop=False)
Stop the actor’s event loop. All actor tasks will be cancelled, the connection to the motor will be shutdown, and the event loop will be stopped.
- Parameters:
delay_loop_stop (bool) – If
True, then do NOT stop the event loop. In this case it is assumed the calling functionality is managing additional tasks in the event loop, and it is up to that functionality to stop the loop. (DEFAULT:False)
- validate_motion_group(mg_config: Dict[str, Any] | MotionGroup | MotionGroupConfig, identifier: str | int = None) bool