Skip to content

Commit

Permalink
refactor(framework:skip) Set isolation modes as codebase constants (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jafermarq authored Oct 23, 2024
1 parent 6fbd678 commit 49327eb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
5 changes: 2 additions & 3 deletions src/py/flwr/client/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
from flwr.common.address import parse_address
from flwr.common.constant import (
CLIENTAPPIO_API_DEFAULT_ADDRESS,
ISOLATION_MODE_PROCESS,
ISOLATION_MODE_SUBPROCESS,
MISSING_EXTRA_REST,
RUN_ID_NUM_BYTES,
TRANSPORT_TYPE_GRPC_ADAPTER,
Expand All @@ -62,9 +64,6 @@
from .numpy_client import NumPyClient
from .run_info_store import DeprecatedRunInfoStore

ISOLATION_MODE_SUBPROCESS = "subprocess"
ISOLATION_MODE_PROCESS = "process"


def _check_actionable_client(
client: Optional[Client], client_fn: Optional[ClientFnExt]
Expand Down
14 changes: 6 additions & 8 deletions src/py/flwr/client/supernode/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,16 @@
from flwr.common.config import parse_config_args
from flwr.common.constant import (
FLEET_API_GRPC_RERE_DEFAULT_ADDRESS,
ISOLATION_MODE_PROCESS,
ISOLATION_MODE_SUBPROCESS,
TRANSPORT_TYPE_GRPC_ADAPTER,
TRANSPORT_TYPE_GRPC_RERE,
TRANSPORT_TYPE_REST,
)
from flwr.common.exit_handlers import register_exit_handlers
from flwr.common.logger import log, warn_deprecated_feature

from ..app import (
ISOLATION_MODE_PROCESS,
ISOLATION_MODE_SUBPROCESS,
start_client_internal,
)
from ..app import start_client_internal
from ..clientapp.utils import get_load_client_app_fn


Expand Down Expand Up @@ -200,10 +198,10 @@ def _parse_args_run_supernode() -> argparse.ArgumentParser:
ISOLATION_MODE_SUBPROCESS,
ISOLATION_MODE_PROCESS,
],
help="Isolation mode when running `ClientApp` (optional, possible values: "
"`subprocess`, `process`). By default, `ClientApp` runs in the same process "
help="Isolation mode when running a `ClientApp` (optional, possible values: "
"`subprocess`, `process`). By default, a `ClientApp` runs in the same process "
"that executes the SuperNode. Use `subprocess` to configure SuperNode to run "
"`ClientApp` in a subprocess. Use `process` to indicate that a separate "
"a `ClientApp` in a subprocess. Use `process` to indicate that a separate "
"independent process gets created outside of SuperNode.",
)
parser.add_argument(
Expand Down
4 changes: 4 additions & 0 deletions src/py/flwr/common/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
# Message TTL
MESSAGE_TTL_TOLERANCE = 1e-1

# Isolation modes
ISOLATION_MODE_SUBPROCESS = "subprocess"
ISOLATION_MODE_PROCESS = "process"


class MessageType:
"""Message type."""
Expand Down

0 comments on commit 49327eb

Please sign in to comment.