From 5aeb351b8ed217c77dd3d25f2e6fc475ce21d176 Mon Sep 17 00:00:00 2001 From: alexliang Date: Mon, 29 Aug 2022 08:59:28 +0800 Subject: [PATCH 1/2] update cli. --- .../fedml/cli/edge_deployment/client_runner.py | 17 +++++++---------- .../cli/server_deployment/server_runner.py | 2 +- .../communication/mqtt/mqtt_manager.py | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/python/fedml/cli/edge_deployment/client_runner.py b/python/fedml/cli/edge_deployment/client_runner.py index 043535bebe..f565e99188 100755 --- a/python/fedml/cli/edge_deployment/client_runner.py +++ b/python/fedml/cli/edge_deployment/client_runner.py @@ -789,15 +789,6 @@ def send_agent_active_msg(self): def on_agent_mqtt_connected(self, mqtt_client_object): # The MQTT message topic format is as follows: // - # Init the mlops metrics object - if self.mlops_metrics is None: - self.mlops_metrics = MLOpsMetrics() - self.mlops_metrics.set_messenger(self.mqtt_mgr) - self.mlops_metrics.report_client_training_status(self.edge_id, ClientConstants.MSG_MLOPS_CLIENT_STATUS_IDLE) - MLOpsStatus.get_instance().set_client_agent_status( - self.edge_id, ClientConstants.MSG_MLOPS_CLIENT_STATUS_IDLE - ) - # Setup MQTT message listener for starting training topic_start_train = "flserver_agent/" + str(self.edge_id) + "/start_train" self.mqtt_mgr.add_message_listener(topic_start_train, self.callback_start_train) @@ -836,7 +827,7 @@ def on_agent_mqtt_connected(self, mqtt_client_object): mqtt_client_object.subscribe(topic_exit_train_with_exception) # Broadcast the first active message. - self.send_agent_active_msg() + # self.send_agent_active_msg() # Echo results click.echo("") @@ -872,6 +863,12 @@ def setup_agent_mqtt_connection(self, service_config): self.mqtt_mgr.add_disconnected_listener(self.on_agent_mqtt_disconnected) self.mqtt_mgr.connect() + self.setup_client_mqtt_mgr() + self.wait_client_mqtt_connected() + self.mlops_metrics.report_client_training_status(self.edge_id, + ClientConstants.MSG_MLOPS_CLIENT_STATUS_IDLE) + self.release_client_mqtt_mgr() + def start_agent_mqtt_loop(self): # Start MQTT message loop try: diff --git a/python/fedml/cli/server_deployment/server_runner.py b/python/fedml/cli/server_deployment/server_runner.py index d3c649131b..5ef6e99373 100755 --- a/python/fedml/cli/server_deployment/server_runner.py +++ b/python/fedml/cli/server_deployment/server_runner.py @@ -1109,7 +1109,7 @@ def on_agent_mqtt_connected(self, mqtt_client_object): mqtt_client_object.subscribe(topic_server_active_msg) # Broadcast the first active message. - self.send_agent_active_msg() + # self.send_agent_active_msg() # Echo results click.echo("") diff --git a/python/fedml/core/distributed/communication/mqtt/mqtt_manager.py b/python/fedml/core/distributed/communication/mqtt/mqtt_manager.py index 5769b7438c..ad06a2473f 100644 --- a/python/fedml/core/distributed/communication/mqtt/mqtt_manager.py +++ b/python/fedml/core/distributed/communication/mqtt/mqtt_manager.py @@ -75,7 +75,7 @@ def send_message(self, topic, message, wait_for_publish=True): MLOpsProfilerEvent.log_to_wandb({"Comm/send_delay_mqtt": time.time() - mqtt_send_start_time}) def send_message_json(self, topic, message, wait_for_publish=True): - ret_info = self._client.publish(topic, payload=message, qos=2) + ret_info = self._client.publish(topic, payload=message) if wait_for_publish: try: ret_info.wait_for_publish(1) From 9c2629068d72877362e9e6f766f7445229a6daa0 Mon Sep 17 00:00:00 2001 From: Chaoyang He Date: Sun, 28 Aug 2022 18:39:24 -0700 Subject: [PATCH 2/2] update doc --- doc/en/cross-silo/examples.md | 5 +++-- doc/en/feature/fedml_feature_overview.md | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 doc/en/feature/fedml_feature_overview.md diff --git a/doc/en/cross-silo/examples.md b/doc/en/cross-silo/examples.md index b6a9ec5afd..418916a0c8 100644 --- a/doc/en/cross-silo/examples.md +++ b/doc/en/cross-silo/examples.md @@ -4,9 +4,9 @@ - [mqtt_s3_fedavg_mnist_lr_example](./examples/mqtt_s3_fedavg_mnist_lr_example.md): an example to illustrate running horizontal federated learning in data silos (hospitals, banks, etc.) -- [mqtt_s3_fedavg_mnist_lr_example](./examples/mqtt_s3_fedavg_attack_mnist_lr_example.md): an example to illustrate running attackers on horizontal federated learning +- [mqtt_s3_fedavg_attack_mnist_lr_example](./examples/mqtt_s3_fedavg_attack_mnist_lr_example.md): an example to illustrate running attackers on horizontal federated learning -- [mqtt_s3_fedavg_mnist_lr_example](./examples/mqtt_s3_fedavg_defense_mnist_lr_example.md): an example to illustrate running defense methods on horizontal federated learning +- [mqtt_s3_fedavg_defense_mnist_lr_example](./examples/mqtt_s3_fedavg_defense_mnist_lr_example.md): an example to illustrate running defense methods on horizontal federated learning ## Hierarchical Federated Learning @@ -15,3 +15,4 @@ As shown in the figure below, here `hierarchical` implies that each FL Client (d parrot + diff --git a/doc/en/feature/fedml_feature_overview.md b/doc/en/feature/fedml_feature_overview.md new file mode 100644 index 0000000000..476060daaf --- /dev/null +++ b/doc/en/feature/fedml_feature_overview.md @@ -0,0 +1,2 @@ +# Overview +