Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(framework) Add run_config to ClientApp Context #3751

Merged
merged 39 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
dc4c5b7
feat(framework:skip) Add override to context and utility funcion
charlesbvll Jul 8, 2024
110031d
Fix docstring formatting
charlesbvll Jul 8, 2024
563bfeb
Remove non parameter from docstring
charlesbvll Jul 8, 2024
c38e0dd
Split function calls to multiple lines
charlesbvll Jul 8, 2024
ff10f09
Return empty dict if config doesn't exist
charlesbvll Jul 8, 2024
a4478cc
Add test for fusing dicts
charlesbvll Jul 8, 2024
bffa910
Remove ability to add new values
charlesbvll Jul 8, 2024
0010d2e
Remove unused imports
charlesbvll Jul 8, 2024
592c6d4
Merge branch 'main' into add-override-common
charlesbvll Jul 8, 2024
ec48536
feat(framework) Add `run_config` to `ClientApp` `Context`
charlesbvll Jul 8, 2024
0ef7d36
Merge branch 'add-override-common' into add-override-clientapp
charlesbvll Jul 8, 2024
a971117
Merge branch 'main' into add-override-clientapp
charlesbvll Jul 8, 2024
4baef0c
Merge branch 'main' into add-override-clientapp
charlesbvll Jul 8, 2024
c1b3b16
Merge branch 'main' into add-override-clientapp
charlesbvll Jul 9, 2024
dd22377
Merge branch 'main' into add-override-clientapp
danieljanes Jul 9, 2024
de63171
refactor(framework:skip) Add run_config as required parameter to Context
charlesbvll Jul 9, 2024
951f08a
Merge branch 'add-run-config-context' into add-override-clientapp
charlesbvll Jul 9, 2024
a252dc5
Only add config on first start
charlesbvll Jul 9, 2024
f71a1a9
Remove unused import
charlesbvll Jul 9, 2024
f398fe9
Merge branch 'main' into add-override-clientapp
charlesbvll Jul 9, 2024
13cd1ab
Merge branch 'main' into add-override-clientapp
danieljanes Jul 9, 2024
d1e1557
Merge branch 'main' into add-override-clientapp
charlesbvll Jul 10, 2024
248069a
Make run_config unmodifiable
charlesbvll Jul 10, 2024
4b75feb
Merge branch 'main' into add-override-clientapp
charlesbvll Jul 10, 2024
648d414
Fix node_state
charlesbvll Jul 10, 2024
c0a7c33
Add type annotation
charlesbvll Jul 10, 2024
a9bfc70
Merge branch 'main' into add-override-clientapp
danieljanes Jul 11, 2024
a64379e
Fix node_state
charlesbvll Jul 11, 2024
5209b16
Fix node state
charlesbvll Jul 11, 2024
df59133
Add RunInfo dataclass
charlesbvll Jul 11, 2024
1962c4a
Fix test
charlesbvll Jul 11, 2024
7996a61
Merge branch 'main' into add-override-clientapp
charlesbvll Jul 11, 2024
1102bd3
Merge branch 'main' into add-override-clientapp
charlesbvll Jul 11, 2024
7f7aad1
Improve naming
charlesbvll Jul 11, 2024
f2a8123
Merge branch 'add-override-clientapp' of https://github.com/adap/flow…
charlesbvll Jul 11, 2024
f25762d
Merge branch 'main' into add-override-clientapp
charlesbvll Jul 11, 2024
6ea228b
Fix CI
charlesbvll Jul 11, 2024
185fd4a
Rename run_info
charlesbvll Jul 11, 2024
06ecf9a
Rename run_info to run_infos
charlesbvll Jul 11, 2024
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
11 changes: 11 additions & 0 deletions src/py/flwr/client/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import time
from dataclasses import dataclass
from logging import DEBUG, ERROR, INFO, WARN
from pathlib import Path
from typing import Callable, ContextManager, Dict, Optional, Tuple, Type, Union

from cryptography.hazmat.primitives.asymmetric import ec
Expand All @@ -29,6 +30,7 @@
from flwr.client.typing import ClientFnExt
from flwr.common import GRPC_MAX_MESSAGE_LENGTH, EventType, Message, event
from flwr.common.address import parse_address
from flwr.common.config import get_fused_config
from flwr.common.constant import (
MISSING_EXTRA_REST,
TRANSPORT_TYPE_GRPC_ADAPTER,
Expand Down Expand Up @@ -193,6 +195,7 @@ def _start_client_internal(
max_retries: Optional[int] = None,
max_wait_time: Optional[float] = None,
partition_id: Optional[int] = None,
flwr_dir: Optional[Path] = None,
) -> None:
"""Start a Flower client node which connects to a Flower server.

Expand Down Expand Up @@ -239,6 +242,13 @@ class `flwr.client.Client` (default: None)
partition_id: Optional[int] (default: None)
The data partition index associated with this node. Better suited for
prototyping purposes.
flwr_dir: Optional[Path] (default: None)
The path containing installed Flower Apps.
charlesbvll marked this conversation as resolved.
Show resolved Hide resolved
By default, this value is equal to:

- `$FLWR_HOME/` if `$FLWR_HOME` is defined
- `$XDG_DATA_HOME/.flwr/` if `$XDG_DATA_HOME` is defined
- `$HOME/.flwr/` in all other cases
charlesbvll marked this conversation as resolved.
Show resolved Hide resolved
"""
if insecure is None:
insecure = root_certificates is None
Expand Down Expand Up @@ -378,6 +388,7 @@ def _on_backoff(retry_state: RetryState) -> None:

# Retrieve context for this run
context = node_state.retrieve_context(run_id=run_id)
context.run_config = get_fused_config(run_info[run_id], flwr_dir)
charlesbvll marked this conversation as resolved.
Show resolved Hide resolved

# Create an error reply message that will never be used to prevent
# the used-before-assignment linting error
Expand Down
1 change: 1 addition & 0 deletions src/py/flwr/client/supernode/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def run_supernode() -> None:
max_retries=args.max_retries,
max_wait_time=args.max_wait_time,
partition_id=args.partition_id,
flwr_dir=get_flwr_dir(args.flwr_dir),
)

# Graceful shutdown
Expand Down