MetOffice / dagrunner

⛔[EXPERIMENTAL] Directed acyclic graph (DAG) runner and tools
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

ENH: Support passing parameters for plugin class initialisation #40

Closed cpelley closed 2 months ago

cpelley commented 2 months ago

From the work in https://github.com/metoppv/improver/issues/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 commented 2 months ago

@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.