Skip to content

Commit

Permalink
[KED-2171] Fix IPython init script bug causing hooks to be registered…
Browse files Browse the repository at this point in the history
… twice (#832)
  • Loading branch information
Lorena Bălan authored Oct 21, 2020
1 parent f56ed16 commit 93058c3
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pathlib import Path

from IPython.core.magic import register_line_magic, needs_local_scope
from kedro.framework.hooks import get_hook_manager

# Find the project root (./../../../)
startup_error = None
Expand Down Expand Up @@ -38,6 +39,13 @@ def reload_kedro(path, line=None):
for module in to_remove:
del sys.modules[module]

# clear hook manager; hook implementations will be re-registered when the
# context is instantiated again in `load_context()` below
hook_manager = get_hook_manager()
name_plugin_pairs = hook_manager.list_name_plugin()
for name, plugin in name_plugin_pairs:
hook_manager.unregister(name=name, plugin=plugin)

logging.debug("Loading the context from %s", str(path))
# Reload context to fix `pickle` related error (it is unable to serialize reloaded objects)
# Some details can be found here:
Expand Down

0 comments on commit 93058c3

Please sign in to comment.