-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Labels
Description
Implement a helper Extension that makes it easy to create a custom Extension that takes no manager as an argument and executes a pure custom function controlled by a trigger.
Custom functions that do not take manager as an argument can perform two main operations
- Side-effect operations on arguments
- report on execution
ppe.reporting.report()
As for side-effect operations, it is not possible to control them as a function of PPE due to the python specification, so no specific action is taken.
The report function would be more convenient if it could report on values returned by dict, following the PPE's handler module.
Therefore, I would implement it with the following interface
class UserFunctionExtension(Extension):
priority = PRIORITY_WRITER
def __init__(self, fn: Callable[..., Dict[str, Scalar]], args: Sequenc[Any], kwargs: Mapping[Any], report_prefix: str = None, priority: int = PRIORITY_WRITER) -> None:
...