Skip to content

Commit

Permalink
Fix circular import
Browse files Browse the repository at this point in the history
  • Loading branch information
chongshenng committed Nov 6, 2024
1 parent 5c38ece commit e7c7520
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 5 additions & 6 deletions src/py/flwr/client/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
from flwr.cli.install import install_from_fab
from flwr.client.client import Client
from flwr.client.client_app import ClientApp, LoadClientAppError

# from flwr.client.supernode.nodestate.nodestate_factory import NodeStateFactory
from flwr.client.supernode.nodestate.nodestate_factory import NodeStateFactory
from flwr.client.typing import ClientFnExt
from flwr.common import GRPC_MAX_MESSAGE_LENGTH, Context, EventType, Message, event
from flwr.common.address import parse_address
Expand Down Expand Up @@ -367,8 +366,8 @@ def _on_backoff(retry_state: RetryState) -> None:

# DeprecatedRunInfoStore gets initialized when the first connection is established
run_info_store: Optional[DeprecatedRunInfoStore] = None
# state_factory = NodeStateFactory()
# state = state_factory.state()
state_factory = NodeStateFactory()
state = state_factory.state()

runs: dict[int, Run] = {}

Expand Down Expand Up @@ -464,8 +463,8 @@ def _on_backoff(retry_state: RetryState) -> None:
run.fab_id, run.fab_version = fab_id, fab_version

# Set node_id for this run
# if node_id is not None:
# state.set_node_id(run_id, node_id)
if node_id is not None:
state.set_node_id(run_id, node_id)

# Register context for this run
run_info_store.register_context(
Expand Down
4 changes: 3 additions & 1 deletion src/py/flwr/client/supernode/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@
from flwr.common.exit_handlers import register_exit_handlers
from flwr.common.logger import log, warn_deprecated_feature

from ..app import start_client_internal
from ..clientapp.utils import get_load_client_app_fn


def run_supernode() -> None:
"""Run Flower SuperNode."""
# Import start_client_internal here to avoid circular imports
from ..app import start_client_internal # pylint: disable=import-outside-toplevel

args = _parse_args_run_supernode().parse_args()
_warn_deprecated_server_arg(args)

Expand Down

0 comments on commit e7c7520

Please sign in to comment.