kedro-org / kedro

Kedro is a toolbox for production-ready data science. It uses software engineering best practices to help you create data engineering and data science pipelines that are reproducible, maintainable, and modular.
https://kedro.org
Apache License 2.0
9.53k stars 877 forks source link

Missing run_result in after_pipeline_run hook #571

Closed applelok closed 3 years ago

applelok commented 3 years ago

Description

Missing run_result parameter in after_pipeline_run hook definition.

Context

I would like to implement my custom hook after_pipeline_run to retrieve the run_result, but program failed to execute once I implemented the hook with run_result: Dict[str, Any] parameter.

@hook_impl
    def after_pipeline_run(self, run_params: Dict[str, Any], run_result: Dict[str, Any], pipeline: Pipeline, catalog: DataCatalog) -> None:
        print(run_result, run_params)

Steps to Reproduce

  1. Implement after_pipeline_run
  2. Run kedro run
  3. Show {'run_result'} are declared in the hookimpl but can not be found in the hookspec error

Expected Result

Should be able to implement hook with run_result

Actual Result

Failed to implement hook with run_result since hook specification did not declare

-- If you received an error, place it here.
pluggy.manager.PluginValidationError: Plugin '2573623562696' for hook 'after_pipeline_run'
hookimpl definition: after_pipeline_run(run_params: Dict[str, Any], run_result: Dict[str, Any], pipeline: kedro.pipeline.pipeline.Pipeline, catalog: kedro.io.data_catalog.DataCatalog) -> None
Argument(s) {'run_result'} are declared in the hookimpl but can not be found in the hookspec

Your Environment

Include as many relevant details about the environment in which you experienced the bug:

921kiyo commented 3 years ago

@applelok Thank you for reporting it! Looks like run_result is missing from a Hook spec. Let me quickly fix it.

921kiyo commented 3 years ago

Fixed in https://github.com/quantumblacklabs/kedro/commit/f5b09917a9301469d452de69da105b2941e8d18f

maria-olivia-lihn commented 3 years ago

Hi ! I had the same issue with run_params and journals. Is it possible to add them to Hook spec? I am looking to use run_params in after_catalog_created