Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions framework/py/flwr/cli/ls.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def ls( # pylint: disable=too-many-locals, too-many-branches, R0913, R0917
typer.Option(
"--limit",
help="Maximum number of runs to display",
min=1,
),
] = None,
output_format: Annotated[
Expand Down Expand Up @@ -105,9 +106,7 @@ def ls( # pylint: disable=too-many-locals, too-many-branches, R0913, R0917
superlink_connection = read_superlink_connection(superlink)
channel = None

# Check `--limit` is positive and not used together with `--run-id`
if limit is not None and limit <= 0:
raise ValueError("The option '--limit' must be an integer greater than 0.")
# Check `--limit` is not used together with `--run-id`
if limit is not None and run_id is not None:
raise ValueError(
"The options '--run-id' and '--limit' cannot be used together."
Expand Down
2 changes: 1 addition & 1 deletion framework/py/flwr/common/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ class ExecPluginType:

CLIENT_APP = "clientapp"
SERVER_APP = "serverapp"
SIMULATION = "simulation"
SIMULATION = "simulation" # Deprecated

def __new__(cls) -> ExecPluginType:
"""Prevent instantiation."""
Expand Down
3 changes: 2 additions & 1 deletion framework/py/flwr/common/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from flwr.app.user_config import UserConfig
from flwr.proto.federation_pb2 import Member # pylint: disable=E0611
from flwr.proto.node_pb2 import NodeInfo # pylint: disable=E0611
from flwr.supercore.constant import RunType

NDArray = npt.NDArray[Any]
NDArrayInt = npt.NDArray[np.int_]
Expand Down Expand Up @@ -259,7 +260,7 @@ def create_empty(cls, run_id: int) -> "Run":
bytes_sent=0,
bytes_recv=0,
clientapp_runtime=0.0,
run_type="",
run_type=RunType.SERVER_APP,
)


Expand Down
5 changes: 1 addition & 4 deletions framework/py/flwr/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,7 @@ def run_superlink() -> None:
appio_address = resolve_bind_address(serverappio_address)
command = ["flower-superexec", "--insecure"]
command += ["--appio-api-address", appio_address]
command += [
"--plugin-type",
ExecPluginType.SIMULATION if is_simulation else ExecPluginType.SERVER_APP,
]
command += ["--plugin-type", ExecPluginType.SERVER_APP]
command += ["--parent-pid", str(os.getpid())]
# pylint: disable-next=consider-using-with
subprocess.Popen(command)
Expand Down
6 changes: 3 additions & 3 deletions framework/py/flwr/simulation/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
from flwr.simulation.simulationio_connection import SimulationIoConnection
from flwr.supercore.app_utils import start_parent_process_monitor
from flwr.supercore.heartbeat import HeartbeatSender, make_app_heartbeat_fn_grpc
from flwr.supercore.superexec.plugin import SimulationExecPlugin
from flwr.supercore.superexec.plugin import ServerAppExecPlugin
from flwr.supercore.superexec.run_superexec import run_with_deprecation_warning


Expand All @@ -91,8 +91,8 @@ def flwr_simulation() -> None:
if args.token is None:
run_with_deprecation_warning(
cmd="flwr-simulation",
plugin_type=ExecPluginType.SIMULATION,
plugin_class=SimulationExecPlugin,
plugin_type=ExecPluginType.SERVER_APP,
plugin_class=ServerAppExecPlugin,
stub_class=ServerAppIoStub,
appio_api_address=args.serverappio_api_address,
parent_pid=args.parent_pid,
Expand Down
13 changes: 10 additions & 3 deletions framework/py/flwr/supercore/cli/flower_superexec.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


import argparse
from logging import INFO
from logging import INFO, WARN
from typing import Any

import yaml
Expand All @@ -33,7 +33,6 @@
ClientAppExecPlugin,
ExecPlugin,
ServerAppExecPlugin,
SimulationExecPlugin,
)
from flwr.supercore.superexec.run_superexec import run_superexec
from flwr.supercore.update_check import warn_if_flwr_update_available
Expand Down Expand Up @@ -97,6 +96,15 @@ def flower_superexec() -> None:
)

# Get the plugin class and stub class based on the plugin type
if args.plugin_type == ExecPluginType.SIMULATION:
log(
WARN,
"The '%s' plugin type is deprecated and will be removed in a future "
"release. Please use '%s' plugin type instead.",
ExecPluginType.SIMULATION,
ExecPluginType.SERVER_APP,
)
args.plugin_type = ExecPluginType.SERVER_APP
plugin_class, stub_class = _get_plugin_and_stub_class(args.plugin_type)
run_superexec(
plugin_class=plugin_class,
Expand Down Expand Up @@ -155,7 +163,6 @@ def _get_plugin_and_stub_class(
mapping: dict[str, tuple[type[ExecPlugin], type[object]]] = {
ExecPluginType.CLIENT_APP: (ClientAppExecPlugin, ClientAppIoStub),
ExecPluginType.SERVER_APP: (ServerAppExecPlugin, ServerAppIoStub),
ExecPluginType.SIMULATION: (SimulationExecPlugin, ServerAppIoStub),
}
if plugin_type in mapping:
return mapping[plugin_type]
Expand Down
2 changes: 0 additions & 2 deletions framework/py/flwr/supercore/superexec/plugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@
from .clientapp_exec_plugin import ClientAppExecPlugin
from .exec_plugin import ExecPlugin
from .serverapp_exec_plugin import ServerAppExecPlugin
from .simulation_exec_plugin import SimulationExecPlugin

__all__ = [
"ClientAppExecPlugin",
"ExecPlugin",
"ServerAppExecPlugin",
"SimulationExecPlugin",
]
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@


import subprocess
from logging import ERROR
from typing import Any

from flwr.common.logger import log
from flwr.supercore.constant import RunType

from .base_exec_plugin import BaseExecPlugin


Expand All @@ -27,7 +31,6 @@ class ServerAppExecPlugin(BaseExecPlugin):
The plugin always selects the first candidate run ID.
"""

command = "flwr-serverapp"
appio_api_address_arg = "--serverappio-api-address"

def get_popen_kwargs(self) -> dict[str, Any]:
Expand All @@ -36,3 +39,18 @@ def get_popen_kwargs(self) -> dict[str, Any]:
"stdout": subprocess.DEVNULL,
"stderr": subprocess.DEVNULL,
}

def launch_app(self, token: str, run_id: int) -> None:
"""Launch the application associated with a given run ID and token."""
# Determine the command to launch based on the run type
run = self.get_run(run_id)
if run.run_type == RunType.SERVER_APP:
self.command = "flwr-serverapp"
elif run.run_type == RunType.SIMULATION:
self.command = "flwr-simulation"
else:
log(ERROR, "Unknown run type '%s' for run_id %d.", run.run_type, run_id)
return

# Launch the executor process
super().launch_app(token, run_id)

This file was deleted.

Loading