Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom function extension #771

Open
linshokaku opened this issue Oct 27, 2023 · 1 comment · May be fixed by #782
Open

Custom function extension #771

linshokaku opened this issue Oct 27, 2023 · 1 comment · May be fixed by #782
Assignees

Comments

@linshokaku
Copy link
Member

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:
        ...
@linshokaku
Copy link
Member Author

There is a need to clarify that it is easy to report() the results of the execution to avoid confusion caused by duplication of functionality with the conventional make_extension().

@linshokaku linshokaku linked a pull request Oct 31, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants