From 56df5cb2bbf523b1525f3932a5f258b35385e972 Mon Sep 17 00:00:00 2001 From: Andreas Hellander Date: Wed, 24 Apr 2024 09:20:20 +0200 Subject: [PATCH] Feature/SK-817: Update asyc-client entrypoints to support new features in the CLI (#588) --- examples/async-clients/README.md | 4 ++-- examples/async-clients/client/fedn.yaml | 6 ++++-- examples/async-clients/run_clients.py | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/async-clients/README.md b/examples/async-clients/README.md index 2e2724104..12d55ac62 100644 --- a/examples/async-clients/README.md +++ b/examples/async-clients/README.md @@ -36,11 +36,11 @@ pip install -r requirements.txt Create the compute package and seed model: ``` -tar -czvf package.tgz client +fedn package create --path client ``` ``` -python client/entrypoint init_seed +fedn run build --path client ``` You will now have a file 'seed.npz' in the directory. diff --git a/examples/async-clients/client/fedn.yaml b/examples/async-clients/client/fedn.yaml index 09002ea0c..1b08e4c81 100644 --- a/examples/async-clients/client/fedn.yaml +++ b/examples/async-clients/client/fedn.yaml @@ -1,5 +1,7 @@ entry_points: + build: + command: python entrypoint.py init_seed ../seed.npz train: - command: python entrypoint.py train $ENTRYPOINT_OPTS + command: python entrypoint.py train validate: - command: python entrypoint.py validate $ENTRYPOINT_OPTS \ No newline at end of file + command: python entrypoint.py validate \ No newline at end of file diff --git a/examples/async-clients/run_clients.py b/examples/async-clients/run_clients.py index 2293c6be2..5b56c53c9 100644 --- a/examples/async-clients/run_clients.py +++ b/examples/async-clients/run_clients.py @@ -24,16 +24,18 @@ from fedn.network.clients.client import Client +# Use with a local deployment settings = { 'DISCOVER_HOST': '127.0.0.1', 'DISCOVER_PORT': 8092, + 'TOKEN': None, 'N_CLIENTS': 10, 'N_CYCLES': 100, 'CLIENTS_MAX_DELAY': 10, 'CLIENTS_ONLINE_FOR_SECONDS': 120 } -client_config = {'discover_host': settings['DISCOVER_HOST'], 'discover_port': settings['DISCOVER_PORT'], 'token': None, 'name': 'testclient', +client_config = {'discover_host': settings['DISCOVER_HOST'], 'discover_port': settings['DISCOVER_PORT'], 'token': settings['TOKEN'], 'name': 'testclient', 'client_id': 1, 'remote_compute_context': True, 'force_ssl': False, 'dry_run': False, 'secure': False, 'preshared_cert': False, 'verify': False, 'preferred_combiner': False, 'validator': True, 'trainer': True, 'init': None, 'logfile': 'test.log', 'heartbeat_interval': 2,