Closed Zaharid closed 8 years ago
Thanks for this. I had a look and it seems quite reasonable to me. Currently I can only suggest to extend the possibility to change the dependency resolver algorithm on-the-fly with a switcher or DAG attribute.
I would like to propose a quick test to check the behaviour of the code in a "real validphys" environment, e.g. create a PDF container, allocate 3 nodes with NNPDF, CT, MSTW and output the PDF values to screen. For the next steps I could imagine that we should be able to have a primitive template to control the PDF values and a basic input parser to load the PDF set names.
This implements the basic functionality for building resources out of function declarations and namespaces.
The user passes:
__dict__
attribute, in particular a class (which is good for testing) or a module (which is good for developing).A set of targets identifying the resources the user wants to obtain in the end.
The arguments get wired by name to the appropriate graph, which in turn can be executed. If they exist in the namespace, they are resolved from there, and otherwise they are computed from a provider. Several checks on the input are performed and try to raise an useful error in case something doesn't work.
The interfaces needs some polishing and not all the features are implemented and tested (in particular there is nothing on checks, and functions with different parameters would overwrite each other in the namespace) but it's functional at the moment.
Since
ResourceExecutor
is simple and clean, much unlikeResourceBuilder
, which implements some questionable design choices (e.g. the idea of identifying nodes from argument names could use some generalization) and has to grow some more, maybe they should live in separate modules (and the executor can be useful on its own).