-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes # . ### Description This PR implements support of using relays in building NVFLARE cellnet. Relays are nodes in the cellnet that are only used for routing messages. They do not have any learning functions. This is the Part 1 of the relay support. It does not include provisioning functions for creating startup kits for relays. These functions will be done in future PRs. Just like regular clients, relays also register to the Server when they are started. Once successfully registered, the Server sends auth token and signature to the relay. Relay nodes also perform message authentication: relays validate auth headers for all messages going thru them. Since all cross-site messages must go thru either the server or relays (or both), by enforcing message authentication at both the Server and relays ensure that no cross-site messages can go through without valid auth headers. Currently peers of a CellPipe can only communicate via the Server. This PR includes an enhancement that allows peers to communicate via CP or Relay nodes. This can make the peer-to-peer communication more efficient. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Quick tests passed locally by running `./runtest.sh`. - [ ] In-line docstrings updated. - [ ] Documentation updated.
- Loading branch information
1 parent
96dcd0e
commit de829ce
Showing
49 changed files
with
1,468 additions
and
377 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
from nvflare.apis.fl_constant import ConnPropKey, FLMetaKey | ||
from nvflare.apis.fl_context import FLContext | ||
from nvflare.fuel.data_event.utils import get_scope_property | ||
|
||
|
||
def update_export_props(props: dict, fl_ctx: FLContext): | ||
site_name = fl_ctx.get_identity_name() | ||
auth_token = get_scope_property(scope_name=site_name, key=FLMetaKey.AUTH_TOKEN, default="NA") | ||
signature = get_scope_property(scope_name=site_name, key=FLMetaKey.AUTH_TOKEN_SIGNATURE, default="NA") | ||
|
||
props[FLMetaKey.SITE_NAME] = site_name | ||
props[FLMetaKey.JOB_ID] = fl_ctx.get_job_id() | ||
props[FLMetaKey.AUTH_TOKEN] = auth_token | ||
props[FLMetaKey.AUTH_TOKEN_SIGNATURE] = signature | ||
|
||
root_conn_props = get_scope_property(site_name, ConnPropKey.ROOT_CONN_PROPS) | ||
if root_conn_props: | ||
props[ConnPropKey.ROOT_CONN_PROPS] = root_conn_props | ||
|
||
cp_conn_props = get_scope_property(site_name, ConnPropKey.CP_CONN_PROPS) | ||
if cp_conn_props: | ||
props[ConnPropKey.CP_CONN_PROPS] = cp_conn_props | ||
|
||
relay_conn_props = get_scope_property(site_name, ConnPropKey.RELAY_CONN_PROPS) | ||
if relay_conn_props: | ||
props[ConnPropKey.RELAY_CONN_PROPS] = relay_conn_props |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.