1. This depends a bit on which hooks you're trying...
# beginners-need-help
a
2. This depends a bit on which hooks you're trying to use. Pipeline hooks (i.e.
before_pipeline_run
,
after_pipeline_run
,
on_pipeline_error
) have both
run_params
and
pipeline
available to them as arguments. Hence you could do a conditional hook like this:
Copy code
class Hooks:
    @hook_impl
    def before_pipeline_run(self, run_params: Dict[str, Any]) -> None:
        if run_params["pipeline_name"] == "data_science":
             # code that only runs when you call `kedro run --pipeline=data_science`
Alternatively you can use
pipeline
which will contain the actual
Pipeline
object (i.e. collection of nodes) that kedro is going to execute in that
kedro run