RRoger
11/21/2021, 4:25 AMbefore_node_run
hook to execute?
I added the following in src/bnhm/hooks.py
(as suggested in https://kedro.readthedocs.io/en/stable/07_extend_kedro/02_hooks.html#use-hooks-to-extend-a-node-s-behaviour):
def say_hello(node: Node):
"""An extra behaviour for a node to say hello before running."""
print(f"Hello from {node.name}")
class ProjectHooks:
@hook_impl
def register_config_loader(...):
return ConfigLoader(conf_paths)
@hook_impl
def register_catalog(...):
return ....
@hook_impl
def before_node_run(self, node: Node):
# adding extra behaviour to a single node
if node.name == "Country Plot":
say_hello(node)
The pipeline is as attached.
The output doesn't have the expected "Hellow from Country Plot":
2021-11-21 15:17:45,228 - kedro.framework.session.store - INFO - `read()` not implemented for `BaseSessionStore`. Assuming empty store.
2021-11-21 15:17:45,306 - root - INFO - ** Kedro project bnhm
2021-11-21 15:17:45,768 - kedro.io.data_catalog - INFO - Loading data from `GBIF` (GBIFRequestDataSet)...
2021-11-21 15:17:59,472 - kedro.pipeline.node - INFO - Running node: get_country_plot([GBIF]) -> [country_plot]
2021-11-21 15:17:59,534 - kedro.io.data_catalog - INFO - Saving data to `country_plot` (MatplotlibWriter)...
2021-11-21 15:17:59,608 - kedro.runner.sequential_runner - INFO - Completed 1 out of 1 tasks
2021-11-21 15:17:59,609 - kedro.runner.sequential_runner - INFO - Pipeline execution completed successfully.
2021-11-21 15:17:59,609 - kedro.framework.session.store - INFO - `save()` not implemented for `BaseSessionStore`. Skipping the step.