Skip to content

Commit

Permalink
Add debug level logging for hook execution order
Browse files Browse the repository at this point in the history
Fix gh-1942.

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
  • Loading branch information
astrojuanlu committed May 22, 2023
1 parent 3439e72 commit bebc7eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kedro/framework/cli/hooks/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from .markers import CLI_HOOK_NAMESPACE
from .specs import CLICommandSpecs

logger = logging.getLogger(__name__)

_cli_hook_manager = None

_CLI_PLUGIN_HOOKS = "kedro.cli_hooks"
Expand All @@ -17,6 +19,8 @@ def get_cli_hook_manager():
global _cli_hook_manager
if _cli_hook_manager is None:
_cli_hook_manager = CLIHooksManager()
_cli_hook_manager.trace.root.setwriter(logger.debug)
_cli_hook_manager.enable_tracing()
return _cli_hook_manager


Expand All @@ -42,7 +46,7 @@ def _register_cli_hooks_setuptools(self) -> None:
}

if plugin_names:
logging.getLogger(__name__).debug(
logger.debug(
"Registered CLI hooks from %d installed plugin(s): %s",
len(plugin_names),
", ".join(sorted(plugin_names)),
Expand Down
2 changes: 2 additions & 0 deletions kedro/framework/hooks/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
def _create_hook_manager() -> PluginManager:
"""Create a new PluginManager instance and register Kedro's hook specs."""
manager = PluginManager(HOOK_NAMESPACE)
manager.trace.root.setwriter(logger.debug)
manager.enable_tracing()
manager.add_hookspecs(NodeSpecs)
manager.add_hookspecs(PipelineSpecs)
manager.add_hookspecs(DataCatalogSpecs)
Expand Down

0 comments on commit bebc7eb

Please sign in to comment.