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

kedro-telemetry: Improve performance by switching to after_command_run #4014

Merged
merged 22 commits into from
Aug 1, 2024
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1e67775
Tentative fix for the hook issue
lrcouto Jul 16, 2024
9fca028
Merge branch 'main' into telemetry-improve-cli-performance
lrcouto Jul 17, 2024
29b627f
Merge branch 'main' into telemetry-improve-cli-performance
lrcouto Jul 17, 2024
8e9e5d4
Merge branch 'main' into telemetry-improve-cli-performance
lrcouto Jul 18, 2024
22977d5
Add variable to track if hook was called already
lrcouto Jul 18, 2024
3142ef8
Merge branch 'main' into telemetry-improve-cli-performance
lrcouto Jul 19, 2024
6ee73b8
Properly set exit code when there is an exception
lrcouto Jul 19, 2024
a97a012
Merge branch 'main' into telemetry-improve-cli-performance
lrcouto Jul 24, 2024
45013cf
Add test coverage for exception on after_command_hook
lrcouto Jul 25, 2024
bbab82c
Merge branch 'telemetry-improve-cli-performance' of github.com:kedro-…
lrcouto Jul 25, 2024
66136bd
Add test for the finally block
lrcouto Jul 25, 2024
f5fe4cc
Merge branch 'main' into telemetry-improve-cli-performance
lrcouto Jul 26, 2024
67dd0ff
Merge branch 'main' into telemetry-improve-cli-performance
lrcouto Jul 29, 2024
184c35d
Merge branch 'main' into telemetry-improve-cli-performance
lrcouto Jul 31, 2024
7b592fe
Remove redundant logger configuration on cli.py
lrcouto Jul 31, 2024
c5c22eb
Add minimal required logger config to sned messages to stderr
lrcouto Jul 31, 2024
155a30d
Call sys.exit only once
lrcouto Jul 31, 2024
de64ef7
Lint
lrcouto Jul 31, 2024
f6f657b
Remove comment
lrcouto Aug 1, 2024
b66c0fd
Move exit into exception block
lrcouto Aug 1, 2024
43054c5
Change test
lrcouto Aug 1, 2024
a31f0d4
Merge branch 'main' into telemetry-improve-cli-performance
lrcouto Aug 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions kedro/framework/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from __future__ import annotations

import importlib
import logging
import sys
import traceback
from collections import defaultdict
Expand Down Expand Up @@ -38,6 +39,8 @@
v{version}
"""

logger = logging.getLogger(__name__)


@click.group(context_settings=CONTEXT_SETTINGS, name="Kedro")
@click.version_option(version, "--version", "-V", help="Show version and exit")
Expand Down Expand Up @@ -199,6 +202,13 @@ def main(
click.echo(message)
click.echo(hint)
sys.exit(exc.code)
except Exception as error:
logger.error(f"An error has occurred: {error}")
pass
finally:
self._cli_hook_manager.hook.after_command_run(
project_metadata=self._metadata, command_args=args, exit_code=0
)
ankatiyar marked this conversation as resolved.
Show resolved Hide resolved

@property
def global_groups(self) -> Sequence[click.MultiCommand]:
Expand Down
Loading