Skip to content

refactor(framework): Implement storing/fetching of SimulationConfig from federation manager#6829

Open
jafermarq wants to merge 45 commits intomainfrom
implement-store-fetch-simulation-config
Open

refactor(framework): Implement storing/fetching of SimulationConfig from federation manager#6829
jafermarq wants to merge 45 commits intomainfrom
implement-store-fetch-simulation-config

Conversation

@jafermarq
Copy link
Member

No description provided.

@github-actions github-actions bot added the Maintainer Used to determine what PRs (mainly) come from Flower maintainers. label Mar 24, 2026
Base automatically changed from define-constant-default-simulation-config to main March 24, 2026 15:05
Copilot AI review requested due to automatic review settings March 24, 2026 15:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR wires SimulationConfig through the federation management layer so simulation federations can persist and surface their runtime configuration (via Control API and CLI), instead of treating it as ephemeral/request-only data.

Changes:

  • Extend Federation (proto + Python typing) to carry a SimulationConfig.
  • Add get_simulation_config/set_simulation_config to FederationManager and implement in NoOpFederationManager with in-memory storage + tests.
  • Update ControlServicer/CLI to set, fetch, and display/serialize the simulation config.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
framework/py/flwr/superlink/servicer/control/control_servicer.py Adds config to ShowFederation response and persists config via ConfigureSimulationFederation.
framework/py/flwr/superlink/federation/noop_federation_manager.py Stores/returns SimulationConfig in-memory for the NoOp federation manager.
framework/py/flwr/superlink/federation/noop_federation_manager_test.py Adds tests for default/stored config behavior and copy semantics.
framework/py/flwr/superlink/federation/federation_manager.py Introduces abstract API for getting/setting simulation config per federation.
framework/py/flwr/common/typing.py Extends Federation dataclass to include SimulationConfig.
framework/py/flwr/cli/federation/ls.py Displays simulation config for simulation federations and adds JSON serialization for config.
framework/proto/flwr/proto/federation.proto Adds SimulationConfig config = 8 to Federation.
framework/py/flwr/proto/federation_pb2.py Regenerated protobuf Python output for new Federation.config field.
framework/py/flwr/proto/federation_pb2.pyi Regenerated typing stubs to reflect Federation.config.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +345 to +355
class Federation: # pylint: disable=R0902
"""Federation details."""

name: str
description: str
members: list[Member]
nodes: list[NodeInfo]
runs: list[Run]
archived: bool = False
simulation: bool = False
archived: bool
simulation: bool
config: SimulationConfig
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing Federation.archived/simulation from defaulted fields to required fields and adding required config is a breaking change for callers constructing flwr.common.typing.Federation (external users may rely on the previous defaults). Consider keeping the previous defaults (archived: bool = False, simulation: bool = False) and using a default_factory for config so existing call sites continue to work while still providing a sensible default config.

Copilot uses AI. Check for mistakes.
Comment on lines +53 to +57
def _get_effective_simulation_config(self) -> SimulationConfig:
"""Return the stored simulation configuration or the default copy."""
config = SimulationConfig()
config.CopyFrom(self._simulation_config or DEFAULT_SIMULATION_CONFIG)
return config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a runtime hack. Should we set self._simulation_config to DEFAULT_SIMULATION_CONFIG in .create_federation method if simulation=True?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that's a better approach

jafermarq and others added 2 commits March 24, 2026 17:46
Co-authored-by: Heng Pan <pan@flower.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Maintainer Used to determine what PRs (mainly) come from Flower maintainers. One SuperLink Two Runtimes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants