Lahari Revuri
08/16/2023, 4:39 AMbefore_command_run
) but it never seems to execute no matter what kind of CLI command I try (kedro run
, kedro info
, kedro ipython
, etc). I’ve looked at examples in the docs, kedro-telemetry, and plugins from the community but can’t figure it out. Does anyone know what I'm missing or have an example they could share?
added to setup.py
setup(
entry_points={"kedro.cli_hooks": ["test_plugin = plugin:cli_hooks"]},
)
`plugin.py`(currently at the same level as setup.py
)
import logging
from typing import List
from kedro.framework.cli.hooks import cli_hook_impl
from kedro.framework.startup import ProjectMetadata
logger = logging.getLogger(name)
class ProjectCLIHooks:
@cli_hook_impl
def before_command_run(
self,
project_metadata: ProjectMetadata,
command_args: List[str],
):
<http://logger.info|logger.info>(
"Command %s will be run for project %s", command_args, project_metadata
)
cli_hooks = ProjectCLIHooks()
datajoely
08/16/2023, 9:16 AMpip install -e
the plug-in?Nok Lam Chan
08/16/2023, 12:53 PMbefore_cli_run
hook?Lahari Revuri
08/16/2023, 1:58 PMplugin.py
file. Seems like I'm thinking about this incorrectly?before_command_run
was to parse the runtime arguments and add them to a globals.py file for the config loader to pick up during context creation. (I saw in the code that OmegaConfigLoader
adds runtime args to the parameters key automatically, but I need them in the catalog key).datajoely
08/16/2023, 2:07 PMcli.py
that will override the run command
https://docs.kedro.org/en/0.18.12/development/commands_reference.html#customise-or-override-project-specific-kedro-commandsextra_params
argument to make this accessible to the configloader/catalogFazil B. Topal
08/16/2023, 5:08 PMdatajoely
08/16/2023, 7:43 PMNok Lam Chan
08/16/2023, 10:13 PMLahari Revuri
08/17/2023, 7:15 AMdatajoely
08/17/2023, 9:09 AMFazil B. Topal
08/17/2023, 9:14 AMkedro run --env test --params=countryCode='cz',executionDate='2023-08-13'
I use this in my config files:
${runtimeParam:executionDate}/${runtimeParam:countryCode}
Once omegaconf is tries to load them, it parses using what i sent.
screenshot is how i use this in the python testing 🙂datajoely
08/17/2023, 9:30 AMAnkita Katiyar
08/17/2023, 10:15 AMsettings.py
is also a feature we’ve merged already and will be out in the next release! (https://github.com/kedro-org/kedro/issues/2622) and docs for it - https://docs.kedro.org/en/latest/configuration/advanced_configuration.html#how-to-use-resolvers-in-the-omegaconfigloaderFazil B. Topal
08/17/2023, 12:33 PMmaxLookBackDays: 0 --> Doesnt work
maxLookBackDays: 1 --> It works
Ankita Katiyar
08/25/2023, 12:18 PMFazil B. Topal
08/25/2023, 12:19 PMNok Lam Chan
08/30/2023, 3:22 PMFazil B. Topal
08/30/2023, 3:28 PM