pcdshub / BEAMS

Beamline Engineering Automation Management Systems
Other
1 stars 1 forks source link

Determine if we want to make Worker object base class for instation of work functions in action nodes #28

Closed joshc-slac closed 1 week ago

joshc-slac commented 1 month ago

Want to be more procedural / uniform in how we:

Context / environment

Critical to resolve #27 before further work on this.

Specifically the notions start_work and stop_work could be helpful to be made universal to any "packaged work function" as well as uniform methods to introspect on status of process / offloaded work.

Notions of timeout of work function can also be encoded here.

A related point to BT action nodes is that we currently spawn work threads in the setup phase and signal execution in the initialization phase: https://github.com/pcdshub/BEAMS/blob/4be9dc569c857e275fe573ea19e35b926ec358a1/beams/behavior_tree/ActionNode.py#L42-L47

https://github.com/pcdshub/BEAMS/blob/4be9dc569c857e275fe573ea19e35b926ec358a1/beams/behavior_tree/ActionNode.py#L52-L58

Suggested Solution

Lets sketch out what it would look like to make: https://github.com/pcdshub/BEAMS/blob/4be9dc569c857e275fe573ea19e35b926ec358a1/beams/tree_generator/TreeSerializer.py#L88-L102

This type of work function of type Worker, should dovetail nicely with @tangkong 's efforts on #18

joshc-slac commented 1 month ago

Pros: