Now if you want to make a hooks conditional on a p...
# beginners-need-help
a
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.
Copy code
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`
2 Views