-
-
Notifications
You must be signed in to change notification settings - Fork 766
Expand file tree
/
Copy pathmqtt_topics.py
More file actions
284 lines (210 loc) · 10.2 KB
/
mqtt_topics.py
File metadata and controls
284 lines (210 loc) · 10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
from typing import Union
class MqttTopics:
# The MQTT message topic format is as follows: <sender>/<receiver>/<action>
__last_will_message = "flclient_agent/last_will_msg"
# ============== Server -> Client ==============
# Train Topics
__server_client_start_train = "flserver_agent/{client_id}/start_train"
__server_client_stop_train = "flserver_agent/{client_id}/stop_train"
# Device Monitoring Topics
__server_client_request_device_info = "server/client/request_device_info/{client_id}"
__client_client_agent_status = "fl_client/flclient_agent_{client_id}/status"
__server_server_agent_status = "fl_server/flserver_agent_{server_id}/status"
# ============== Client -> Server ==============
# Metrics and Logs Topics
__client_server_metrics = "fedml_slave/fedml_master/metrics/{run_id}"
__client_server_logs = "fedml_slave/fedml_master/logs/{run_id}"
__client_server_response_device_info = "client/server/response_device_info/{server_id}"
# ============== MLOps -> Client ==============
# Authentication Topics
__mlops_client_logout = "mlops/client/logout/{client_id}"
# Device Monitoring and Library Update Topics
__mlops_client_report_device_status = "mlops/report_device_status"
__mlops_client_ota = "mlops/flclient_agent_{client_id}/ota"
# Deployment Topics
__deploy_mlops_slave_request_device_info = "deploy/mlops/slave_agent/request_device_info/{slave_id}"
__deploy_mlops_client_request_device_info = "deploy/mlops/client_agent/request_device_info/{client_id}"
# ============== MLOps -> Server ==============
__mlops_server_start_train = "mlops/flserver_agent_{server_id}/start_train"
__mlops_server_stop_train = "mlops/flserver_agent_{server_id}/stop_train"
__mlops_server_ota = "mlops/flserver_agent_{server_id}/ota"
# Deployment Topics
__mlops_master_request_device_info = "deploy/mlops/master_agent/request_device_info/{master_id}"
__deploy_mlops_master_request_device_info = "deploy/mlops/master_agent/request_device_info/{master_id}"
# ============== Client -> MLOps ==============
# Monitoring Topics
__client_mlops_status = "fl_client/mlops/status"
__client_mlops_active = "flclient_agent/active"
# Run Topics
__run_client_mlops_status = "fl_run/fl_client/mlops/status"
__run_server_mlops_status = "fl_run/fl_server/mlops/status"
__client_mlops_job_cost = "ml_client/mlops/job_computing_cost"
# ============== Server -> MLOps ==============
# Train Topics
__server_mlops_training_progress = "fl_server/mlops/training_progress_and_eval"
# TODO (alaydshah): Fix the typo (roundx -> rounds)
__server_mlops_training_rounds = "fl_server/mlops/training_roundx"
# Federate Topics
__server_mlops_client_model = "fl_server/mlops/client_model"
__server_mlops_aggregated_model = "fl_server/mlops/global_aggregated_model"
__server_mlops_training_model_net = "fl_server/mlops/training_model_net"
# Deploy Topics
__server_mlops_deploy_progress = "fl_server/mlops/deploy_progress_and_eval"
__model_serving_mlops_llm_input_output_record = "model_serving/mlops/llm_input_output_record"
__deploy_master_mlops_response_device_info = "deploy/master_agent/mlops/response_device_info"
# Monitoring Topics
__server_mlops_active = "flserver_agent/active"
# ============== Device -> MLOps ==============
# Launch Topics
__launch_mlops_artifacts = "launch_device/mlops/artifacts"
__launch_mlops_release_gpu_ids = "launch_device/mlops/release_gpu_ids"
__launch_mlops_sync_deploy_ids = "launch_device/mlops/sync_deploy_ids"
# Deployment Topics
__deploy_mlops_status = "model_ops/model_device/return_deployment_status"
__compute_mlops_endpoint = "compute/mlops/endpoint"
# Device & System Performance Topics
__client_mlops_system_performance = "fl_client/mlops/system_performance"
__client_mlops_gpu_device_info = "ml_client/mlops/gpu_device_info"
# ============== Diagnosis ==============
__test_mqtt_connection = "fedml/{mqtt_client_id}/test_mqtt_msg"
# TODO (alaydshah): Make sure these aren't used anywhere, and clean them up
# ============== Deprecated ==============
__server_run_exception = "flserver_agent/{run_id}/client_exit_train_with_exception"
__server_mlops_status = "fl_server/mlops/status"
__client_mlops_training_metrics = "fl_client/mlops/training_metrics"
__mlops_runtime_logs_run = "mlops/runtime_logs/{run_id}"
@classmethod
def server_client_start_train(cls, client_id: Union[int, str]):
return cls.__server_client_start_train.format(client_id=client_id)
@classmethod
def server_client_stop_train(cls, client_id: Union[int, str]):
return cls.__server_client_stop_train.format(client_id=client_id)
@classmethod
def server_client_request_device_info(cls, client_id: Union[int, str]):
return cls.__server_client_request_device_info.format(client_id=client_id)
@classmethod
def client_client_agent_status(cls, client_id: Union[int, str]):
return cls.__client_client_agent_status.format(client_id=client_id)
@classmethod
def server_server_agent_status(cls, server_id: Union[int, str]):
return cls.__server_server_agent_status.format(server_id=server_id)
@classmethod
def mlops_client_report_device_status(cls):
return cls.__mlops_client_report_device_status
@classmethod
def mlops_client_ota(cls, client_id: Union[int, str]):
return cls.__mlops_client_ota.format(client_id=client_id)
@classmethod
def deploy_mlops_slave_request_device_info(cls, slave_id: Union[int, str]):
return cls.__deploy_mlops_slave_request_device_info.format(slave_id=slave_id)
@classmethod
def mlops_master_request_device_info(cls, master_id: Union[int, str]):
return cls.__mlops_master_request_device_info.format(master_id=master_id)
@classmethod
def mlops_client_logout(cls, client_id: Union[int, str]):
return cls.__mlops_client_logout.format(client_id=client_id)
@classmethod
def deploy_mlops_client_request_device_info(cls, client_id: Union[int, str]):
return cls.__deploy_mlops_client_request_device_info.format(client_id=client_id)
@classmethod
def last_will_message(cls):
return cls.__last_will_message
@classmethod
def client_mlops_status(cls):
return cls.__client_mlops_status
@classmethod
def run_client_mlops_status(cls):
return cls.__run_client_mlops_status
@classmethod
def run_server_mlops_status(cls):
return cls.__run_server_mlops_status
@classmethod
def server_run_exception(cls, run_id: Union[int, str]):
return cls.__server_run_exception.format(run_id=run_id)
@classmethod
def server_mlops_status(cls):
return cls.__server_mlops_status
@classmethod
def client_mlops_training_metrics(cls):
return cls.__client_mlops_training_metrics
@classmethod
def server_mlops_training_progress(cls):
return cls.__server_mlops_training_progress
@classmethod
def server_mlops_deploy_progress(cls):
return cls.__server_mlops_deploy_progress
@classmethod
def mlops_server_ota(cls, server_id: Union[int, str]):
return cls.__mlops_server_ota.format(server_id=server_id)
@classmethod
def client_server_metrics(cls, run_id: Union[int, str]):
return cls.__client_server_metrics.format(run_id=run_id)
@classmethod
def client_server_logs(cls, run_id: Union[int, str]):
return cls.__client_server_logs.format(run_id=run_id)
@classmethod
def server_mlops_training_rounds(cls):
return cls.__server_mlops_training_rounds
@classmethod
def server_mlops_client_model(cls):
return cls.__server_mlops_client_model
@classmethod
def server_mlops_aggregated_model(cls):
return cls.__server_mlops_aggregated_model
@classmethod
def server_mlops_training_model_net(cls):
return cls.__server_mlops_training_model_net
@classmethod
def model_serving_mlops_llm_input_output_record(cls):
return cls.__model_serving_mlops_llm_input_output_record
@classmethod
def client_mlops_job_cost(cls):
return cls.__client_mlops_job_cost
@classmethod
def mlops_runtime_logs_run(cls, run_id: Union[int, str]):
return cls.__mlops_runtime_logs_run.format(run_id=run_id)
@classmethod
def launch_mlops_artifacts(cls):
return cls.__launch_mlops_artifacts
@classmethod
def deploy_mlops_status(cls):
return cls.__deploy_mlops_status
@classmethod
def client_mlops_system_performance(cls):
return cls.__client_mlops_system_performance
@classmethod
def client_mlops_gpu_device_info(cls):
return cls.__client_mlops_gpu_device_info
@classmethod
def compute_mlops_endpoint(cls):
return cls.__compute_mlops_endpoint
@classmethod
def launch_mlops_release_gpu_ids(cls):
return cls.__launch_mlops_release_gpu_ids
@classmethod
def launch_mlops_sync_deploy_ids(cls):
return cls.__launch_mlops_sync_deploy_ids
@classmethod
def mlops_server_start_train(cls, server_id: Union[int, str]):
return cls.__mlops_server_start_train.format(server_id=server_id)
@classmethod
def mlops_server_stop_train(cls, server_id: Union[int, str]):
return cls.__mlops_server_stop_train.format(server_id=server_id)
@classmethod
def client_server_response_device_info(cls, server_id: Union[int, str]):
return cls.__client_server_response_device_info.format(server_id=server_id)
@classmethod
def deploy_mlops_master_request_device_info(cls, master_id: Union[int, str]):
return cls.__deploy_mlops_master_request_device_info.format(master_id=master_id)
@classmethod
def client_mlops_active(cls):
return cls.__client_mlops_active
@classmethod
def server_mlops_active(cls):
return cls.__server_mlops_active
@classmethod
def deploy_master_mlops_response_device_info(cls):
return cls.__deploy_master_mlops_response_device_info
@classmethod
def test_mqtt_connection(cls, mqtt_client_id: Union[int, str]):
return cls.__test_mqtt_connection.format(mqtt_client_id=mqtt_client_id)