Skip to content

Commit

Permalink
fixed poc start command and simulator error message (#3157)
Browse files Browse the repository at this point in the history
…age.

Fixes # .

### Description

- Fix the simulator run missing __server_config__ in FL context error
message due to identify changes.
- Fix the "nvflare poc start" error.



### 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
yhwen authored Jan 20, 2025
1 parent dd4b9a5 commit e130384
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
14 changes: 7 additions & 7 deletions nvflare/lighter/dummy_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ builders:
args:
sp_end_point: server1:8002:8003

docker_image: localhost/nvflare:0.0.1

- path: nvflare.lighter.impl.docker.DockerBuilder
args:
docker_image: localhost/nvflare:0.0.1
base_image: python:3.10
requirements_file: docker_compose_requirements.txt
# docker_image: localhost/nvflare:0.0.1
#
# - path: nvflare.lighter.impl.docker.DockerBuilder
# args:
# docker_image: localhost/nvflare:0.0.1
# base_image: python:3.10
# requirements_file: docker_compose_requirements.txt
- path: nvflare.lighter.impl.cert.CertBuilder
- path: nvflare.lighter.impl.signature.SignatureBuilder
20 changes: 20 additions & 0 deletions nvflare/private/fed/simulator/simulator_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

from ..server.fed_server import FederatedServer
from ..server.server_engine import ServerEngine
from ..utils.identity_utils import IdentityAsserter


class SimulatorServerEngine(ServerEngine):
Expand Down Expand Up @@ -77,6 +78,22 @@ def create_job_processing_context_properties(self, workspace, job_id):
return {}


class SimulatorIdentityAsserter(IdentityAsserter):

def __init__(self, private_key_file: str, cert_file: str):
self.private_key_file = private_key_file
self.cert_file = cert_file

def sign_common_name(self, nonce: str) -> str:
return nonce

def sign(self, content, return_str: bool) -> str:
return "signature"

def verify_signature(self, content, signature) -> bool:
return True


class SimulatorServer(FederatedServer):
def __init__(
self,
Expand Down Expand Up @@ -143,6 +160,9 @@ def _create_server_engine(self, args, snapshot_persistor):
server=self, args=args, client_manager=self.client_manager, snapshot_persistor=snapshot_persistor
)

def _get_id_asserter(self):
return SimulatorIdentityAsserter("private_key_file", "cert_file")

def deploy(self, args, grpc_args=None, secure_train=False):
super(FederatedServer, self).deploy(args, grpc_args, secure_train)
os.makedirs(os.path.join(args.workspace, "local"), exist_ok=True)
Expand Down

0 comments on commit e130384

Please sign in to comment.