Skip to content

feat(actuators): improve the process of using an actuator from within another actuator #169

@VassilisVassiliadis

Description

@VassilisVassiliadis

Is your feature request related to a problem? Please describe.

Currently, to safely re-use the logic of an actuator you have to use the following exitCode:

# pseudocode
actuator_class = registry.actuatorForIdentifier(actuator_identifier)
queue = get_measurement_queue()
actuator = actuator_class.remote(queue=queue, params=actuator_params)

actuator.submit.remote(
    entities=[entity],
    experimentReference=experiment.reference,
    requesterid="run_experiment",
    requestIndex=0,
)

measurementRequest = queue.get()
# inspect measurementRequest.measurements to find the results of the measurement

This is a bit awkward as you have to instantiate a new MeasurementRequestQueue and Actuator instance per call to the Actuator that you would like to reuse.

Otherwise, you risk having multiple instances of the wrapped Actuator pushing their results into the same MeasurementRequestQueue. For example, that would be the case if you were to run your Actuator using the RandomWalk operator with a batchSize of 2.

Describe the solution you'd like

I would like to augment the Actuator API with an async function that returns the array of measurements with the arguments:

  • entity
  • experiment

Additional context

This would also simplify the code that I would write as a developer of an Actuator. For example, ActuatorBase could have a default implementation of submit() which invokes this new method.

Metadata

Metadata

Labels

No fields configured for Feature.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions