refactor(core)!: use class decorators for explore operators and add OperatorMetadata#805
Merged
Conversation
Explore operator function decorator now allows registering the class that embodies the operator. This means orchestrate_explore_operation can be passed an OperatorFunctionConf instance and retrieve the class rather than needed an OperatorModuleConf instance.
Need to use a protocol due to using kwargs
Also compress the decoration/registration to single functions
remove ray decorator if present. Will be re-added if necessary.
OperatorFunctionConf -> OperatorReference Operator -> OperatorMetadata and moved to config.py explore decorator -> now can be used to decorate an explore operator class
Provide fallback implementation for old explore classes.
Use default operation_metadata in the decorator
to avoid circular imports
There is no need for it to return a function so we can actually have it decorate the class as one would expect.
Where appropriate to harmonize terminology. Move actuator ivar definition to parent class.
warn if two operators are loaded with same name.
New updates addressing prior comments
AlessandroPomponio
previously requested changes
Apr 14, 2026
Member
AlessandroPomponio
left a comment
There was a problem hiding this comment.
I still need to look at tests and documentation, but I noticed these things
Member
Author
|
@AlessandroPomponio last comments addressed |
This was referenced Apr 21, 2026
mgazz
pushed a commit
to mgazz/ado
that referenced
this pull request
May 7, 2026
…perators (IBM#886) * fix(orchestration): recursive calling of general operators run_general_operation_core_closure was calling the decorator function not the decorated (wrapped) function. As a result this caused a recursion run_general_operation_core_closure -> orchestrate_general_operation -> run_general_operation_core_closure -> orchestrate_general_operation etc. This was because the function passed to run_general_operation_core_closure was the wrapped function before IBM#805. This was changed to the wrapper function in IBM#805 but the actual call was not updated to account for this. * refactor(trim): Update to access random walk for collection Function is not present after IBM#805 * test(operators): Add a end-to-end test for general orchestration * test(operators): add missing test file * test(operators): add additional tests Installing trim for orchestration tests adds two more custom experiments * fix(tests): Missed changing assertion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce ability to decorate explore operator classes directly avoiding need for a separate function and related issues due to different sources of operator metadata.
For example with this change the operator class defines the operators name; this name is what it is registered as (ado get operators); it is used to generate the operator identifier and operation identifier field values; and it is what appears in operation resource yaml . Previously these could all be set differently.
Changes
@explore_operationto decorate classes directly. No separate function is needed (its generated automatically)RandomWalkandRayTuneto the class-decorator pattern; delete the now-redundant functions for bothOperatorMetadatamodel (moved tocore/operation/config.py) as the single source of truth for each operator's name, version, type, configuration model, and implementation class.OperatorFunctionConf→OperatorReference(deprecated alias kept for backward compatibility).Breaking
The following are not supported any more
operator_metadata().- Instantiating an existing class that does not implement this method will cause
TypeError: Can't instantiate abstract class OPERATOR_CLASS_NAME with abstract method operator_metadata- Calling this class method on the class (without instantiation) will cause
NotImplementedErrorto be raised- Note: Via ado cli user will encounter one of the following two errors first if such a class exists.
- Existing functions decorated with @explore_operation will cause
TypeError:explore_operationtakes 1 positional argument but N were givento be raised when the operator registry is accessed via the cli (e.g. ado get operators, ado create op)ado create op: This was allowed but not documented anywhere as viable approach (existing only in some test files and one old example file). It's no longer allowed.explore_operation: These fields are now required.TypeError:$DECORATOR_NAMEtakes 4 positional arguments but (number less than 4) were givento be raised when the operator registry is accessed via the cli (e.g. ado get operators, ado create op)Deprecation
OperatorFunctionConf: still importable as a deprecated alias forOperatorReference.