-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
The idea is that you can use the explicit_node decorator in the config parser to return functions, which then have the role of providers.
One can do something like:
#provider
def action1(some, required, resources):
...
def action2(totally, different, resources):
....
def generic_table(dispatch_action):
#table that works for both the result of action1 and action2
...
def generic_plot(generic_table):
#A plot that works with the output of generic table and might not care about action1 and action2
...
#config
#class Config ...
@configparser.explicit_node
def produce_dispatch_action(self, dispatch_value:str):
if dispatch_value == "action1":
return action1
elif dispatch_value == "action2":
return action2
raise ConfigError(...)Then one could do:
#runcard.yaml
dispatch_value: "action1"
some: ...
required: ...
input_for_resource_called_resources: ...
actions_:
- generic_plotThis has the crucial advantage that one does not have to redo the whole pipeline (i.e. there is only one generic_table). Runtime dispatch (as in one big substitute of generic_table that takes the inputs of both action1 and action2) will not work well if the various actions have completely different inputs.
One disadvantage is that it obfuscates the help.
This should all b written in the guide somehow.
Metadata
Metadata
Assignees
Labels
No labels