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

ENH: Support passing parameters for plugin class initialisation #40

Merged
merged 3 commits into from
Jul 5, 2024

Conversation

cpelley
Copy link
Collaborator

@cpelley cpelley commented Jul 4, 2024

From the work in metoppv/improver#1998, it has been made clear that some plugin classes are intended to be instantiated with parameters. To that end, we need to ensure that the default plugin executor supports passing such parameters to the plugin class initialisation.

This change achieves this by 'call' optionally supporting a tuple of 2 or 3 in length.
Illustrated as follows:

try:
    callable_obj, callable_kwargs_init, callable_kwargs = call
except ValueError:
    callable_obj, callable_kwargs = call
    callable_kwargs_init = {}

Issues

@cpelley cpelley self-assigned this Jul 4, 2024
@cpelley cpelley changed the title class init arg support Support passing parameters to plugin classes Jul 4, 2024
@cpelley cpelley added the enhancement New feature or request label Jul 4, 2024
@cpelley cpelley changed the title Support passing parameters to plugin classes Support passing parameters to plugin class initialisation Jul 4, 2024
@cpelley cpelley changed the title Support passing parameters to plugin class initialisation Support passing parameters for plugin class initialisation Jul 4, 2024
@cpelley cpelley changed the title Support passing parameters for plugin class initialisation ENH: Support passing parameters for plugin class initialisation Jul 4, 2024
@cpelley
Copy link
Collaborator Author

cpelley commented Jul 4, 2024

@bayliffe, - this change to dagrunner reflects the requirement made apparent from the CLI/plugin changes I have been involved in that you have reviewed. Mainly, providing an ability to pass arguments for class initialisation.

Co-authored-by: mo-robert-purvis <79312282+mo-robert-purvis@users.noreply.github.com>
@cpelley cpelley merged commit cfa6b1a into main Jul 5, 2024
2 checks passed
@cpelley cpelley deleted the CLASS_INITIALISATION branch July 5, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants