feat(actuators): StandardActuator — sync/async base class#955
feat(actuators): StandardActuator — sync/async base class#955michael-johnston wants to merge 8 commits into
Conversation
To use new StandardActuator pattern
- Make NullQueue public - Update init of StandardActuatorBase so queue type is union - Make all ray worker functions decorated (instead of two being dynamically decorated) -
|
TBA: handling of ray helper actors for actuators - like cleanup and console queue that won't be available running outside ray. |
|
|
||
|
|
||
| @ray.remote | ||
| def _run_execute_fn( |
There was a problem hiding this comment.
The name of this function seems a bit too generic
There was a problem hiding this comment.
It is a pretty generic function though.
| try: | ||
| input_values = experiment.propertyValuesFromEntity(entity) | ||
| result_dict = fn(**input_values) | ||
| values = dict_to_measurements(result_dict, experiment) |
There was a problem hiding this comment.
This method should probably be renamed to observed_property_values_from_dicts, since it doesn't return Measurements
| * _experiment_implementations() — simple path: return a mapping from experiment | ||
| identifier to a callable ``fn(**kwargs) -> dict[str, Any]``. The caller | ||
| supplies constitutive property values as kwargs; the callee returns a dict | ||
| whose keys are observed property identifiers. | ||
|
|
||
| * _get_request_executor() — custom path: override to return any zero-argument | ||
| callable that runs the batch and returns a completed MeasurementRequest. | ||
| Use functools.partial or a closure to capture any actuator state required. |
There was a problem hiding this comment.
These seem to be two separate options. If so, it could be worth to have this be an abstract class that can't be instantiated and have two separate subclasses where each implements one option and prevents the other from being used.
It would also be good to have descriptive names for them, although I wouldn't really know what to suggest
| * _experiment_implementations() — simple path: return a mapping from experiment | ||
| identifier to a callable ``fn(**kwargs) -> dict[str, Any]``. The caller | ||
| supplies constitutive property values as kwargs; the callee returns a dict | ||
| whose keys are observed property identifiers. |
There was a problem hiding this comment.
This seems sort of similar to custom_experiments, no?
Introduces StandardActuator, a flexible base class for actuator plugins that provides both synchronous (execute) and asynchronous (submit) execution paths without callers needing to manage Ray actors or MeasurementQueue instances.
Two customisation hooks:
Other changes:
TODO: