Skip to content

Commit ed6189d

Browse files
fix(ado-core): Enable decorated experiments with ray.remote (#213)
Need to change the signature of the wrapper.
1 parent d3e41ea commit ed6189d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

orchestrator/modules/actuators/custom_experiments.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,19 @@ def wrapper(
335335

336336
return observed_property_values
337337

338+
# Set the wrapper's __signature__ so it is (entity,experiment)
339+
# This is required for the wrapped function to be used with ray.remote
340+
import inspect
341+
342+
wrapper.__signature__ = inspect.Signature(
343+
[
344+
inspect.Parameter("entity", inspect.Parameter.POSITIONAL_OR_KEYWORD),
345+
inspect.Parameter(
346+
"experiment", inspect.Parameter.POSITIONAL_OR_KEYWORD
347+
),
348+
]
349+
)
350+
338351
# If we were not given information on required/optional properties
339352
# or parameterization try to infer it
340353
# This function will log a critical error message and raise exception

0 commit comments

Comments
 (0)