Connecting Nodes#
The strength of the ZnTrack package is within connecting nodes. This is easily done by passing one Node as an argument to another one.
Let us assume two Nodes GenerateData
and ProcessData
.
We can connect these Nodes as follows:
with zntrack.Project() as project:
generate_data = GenerateData(**kwargs)
process_data = ProcessData(data=load_data)
project.run()
Now, the process_data.data
attribute will be the loaded instance of GenerateData
, when running dvc repro
.
The following connection has been established:
In some cases it is useful to connect Node attributes instead of Nodes. This can be achieved in the same way.
with zntrack.Project() as project:
generate_data = GenerateData(**kwargs)
process_data = ProcessData(data=generate_data.data)
project.run()
Tip
You can also pass list
or dict
of Nodes or Node attributes to other Nodes.
This allows to easily build sophisticated pipelines with ZnTrack and DVC.