Skip to content

Commit

Permalink
reload all related parameters in runner
Browse files Browse the repository at this point in the history
  • Loading branch information
wangchy27 committed Jan 16, 2025
1 parent 0631b73 commit 3bc1127
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
11 changes: 6 additions & 5 deletions metaflow/runner/deployer_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@ def __init__(

from metaflow.parameters import flow_context

if "metaflow.cli" in sys.modules:
# Reload the CLI with an "empty" flow -- this will remove any configuration
# options. They are re-added in from_cli (called below).
with flow_context(None) as _:
importlib.reload(sys.modules["metaflow.cli"])
# Reload the CLI with an "empty" flow -- this will remove any configuration
# options. They are re-added in from_cli (called below).
to_be_reload = ["metaflow.cli", "metaflow.cli_components.run_cmds", "metaflow.cli_components.init_cmds"]
with flow_context(None):
[importlib.reload(sys.modules[module]) for module in to_be_reload if module in sys.modules]

from metaflow.cli import start
from metaflow.runner.click_api import MetaflowAPI

Expand Down
11 changes: 6 additions & 5 deletions metaflow/runner/metaflow_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,13 @@ def __init__(
# 'from .metaflow_runner import Runner' in '__init__.py'

from metaflow.parameters import flow_context

# Reload the CLI with an "empty" flow -- this will remove any configuration
# options. They are re-added in from_cli (called below).
to_be_reload = ["metaflow.cli", "metaflow.cli_components.run_cmds", "metaflow.cli_components.init_cmds"]
with flow_context(None):
[importlib.reload(sys.modules[module]) for module in to_be_reload if module in sys.modules]

if "metaflow.cli" in sys.modules:
# Reload the CLI with an "empty" flow -- this will remove any configuration
# options. They are re-added in from_cli (called below).
with flow_context(None) as _:
importlib.reload(sys.modules["metaflow.cli"])
from metaflow.cli import start
from metaflow.runner.click_api import MetaflowAPI

Expand Down

0 comments on commit 3bc1127

Please sign in to comment.