Title
#beginners-need-help
antony.milne

antony.milne

02/02/2022, 10:16 AM
Now if you want to make a hooks conditional on a particular pipeline but it's not a pipeline hook (e.g.
before_node_run
) then you'll need to make the pipeline name accessible to your hook by saving the relevant information to the class somehow, e.g.
class Hooks:
    @hook_impl
    def before_pipeline_run(self, run_params: Dict[str, Any]) -> None:
        self.pipeline_name = run_params["pipeline_name"]

    @hook_impl
    def before_node_run(self) -> None:
        if self.pipeline_name == "data_science":
            # code that only runs when you call `kedro run --pipeline=data_science`