Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make configuration more accessible to hook methods #562

Closed
mnowotnik opened this issue Oct 14, 2020 · 1 comment
Closed

Make configuration more accessible to hook methods #562

mnowotnik opened this issue Oct 14, 2020 · 1 comment
Labels
Issue: Feature Request New feature or improvement to existing feature

Comments

@mnowotnik
Copy link

mnowotnik commented Oct 14, 2020

Description

I would like to use hook methods to log events to external systems and use project configuration to do so.

Context

Currently, method before_pipeline_run receives arguments: run_params: Dict[str, Any], pipeline: Pipeline, catalog: DataCatalog.
None of these, allow me to access credentials nor project parameters required to access external services.

Possible Implementation

Pass entire configuration to hook methods.

EDIT*:

I see I could achieve what I want by making hooks a @property in ProjectContext, but it feels a bit hacky since it depends on the initialization order in KedroContext.__init__:

class ProjectContext(KedroContext):

    @property
    def hooks(self):
        return [MyHook(s3_client(self.config_loader)]

However, there are possible problems with this approach: https://waylonwalker.com/blog/whats-new-in-kedro-0164#careful-with-the-singletons

@mnowotnik mnowotnik added the Issue: Feature Request New feature or improvement to existing feature label Oct 14, 2020
@mnowotnik mnowotnik changed the title Support creating pipeline-wide object instances to use in hooks Support creating globally accessible object registry to use in hooks Oct 14, 2020
@mnowotnik mnowotnik changed the title Support creating globally accessible object registry to use in hooks Make configuration more accessible to hook methods Oct 14, 2020
@mnowotnik
Copy link
Author

Duplicated by: #506

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Feature Request New feature or improvement to existing feature
Projects
None yet
Development

No branches or pull requests

1 participant