Hello Kedro Team, We recently upgraded from 0.17.2...
# questions
e
Hello Kedro Team, We recently upgraded from 0.17.2 to 0.17.7 and noticed the “run” command override in “src/project/cli.py::run” is not invoked anymore. The “run” command simply invokes Kedro stock version. We noticed a number of changes in the CLI override code around versions 0.17.5. Any thoughts or suggestions? Thank you.
n
Did you trigger the run with
kedro run
?
https://docs.kedro.org/en/stable/extend_kedro/common_use_cases.html#use-case-3-how-to-add-or-modify-cli-commands We moved the
cli.py
into Kedro core, but the project specific one should still work. I have an relatively old example with 0.18.0 that the
cli.py
still work as expected. https://github.com/noklam/kedro_gallery/blob/master/kedro_cli_extension/src/kedro_cli_extension/cli.py
e
Yes the run was triggered with
kedro run
. What is interesting is if I we invoke some other command in our custom
src<project>/cli.py
those command work. Only the
kedro run
override stopped working for some reason. (our custom
kedro run
has been running for a couple of years in production no problem)
So for example if we rename the function
run -> runx
kedro runx
runs no problem.
I figured it out, at the bottom of our custom cli, the commands were re-added again (no idea why was that done, it is an old project); after I removed (diff below)
kedro run
override works again! Thanks!
Copy code
index 78ef0dc2..a0fd16d0 100755
--- a/src/data_science_cobalt_keepa_processing/cli.py
+++ b/src/data_science_cobalt_keepa_processing/cli.py
@@ -42,11 +42,6 @@ import requests
 import structlog
 from ddtrace import config as ddconfig
 from ddtrace import patch_all, tracer
-from kedro.framework.cli import main as kedro_main
-from kedro.framework.cli.catalog import catalog as catalog_group
-from kedro.framework.cli.jupyter import jupyter as jupyter_group
-from kedro.framework.cli.pipeline import pipeline as pipeline_group
-from kedro.framework.cli.project import project_group
 from kedro.framework.cli.utils import KedroCliError, env_option, split_string
 from kedro.framework.session import KedroSession
 from kedro.utils import load_obj
@@ -447,16 +442,3 @@ def cobalt_db_migrate():
     with backend.lock():
         # Apply any outstanding migrations
         backend.apply_migrations(backend.to_apply(migrations))
-
-
-cli.add_command(pipeline_group)
-cli.add_command(catalog_group)
-cli.add_command(jupyter_group)
-
-for command in project_group.commands.values():
-    cli.add_command(command)
😁 1
n
No worries, so this is just a mistake that
run
was defined twice.
e
Yes 🙂 - and it worked in 0.17.2 as the logic was different; in 0.17.2 the
cli:py::{commands}
were added to the “project_group” so re-adding the commands had not effect.
K 1