Skip to content

Commit

Permalink
feat(framework) Log node_id, fab_hash and run_id on SuperLink (#…
Browse files Browse the repository at this point in the history
…4079)

Signed-off-by: Danny Heinrich <danny.heinrich@flower.ai>
Co-authored-by: Daniel J. Beutel <daniel@flower.ai>
  • Loading branch information
Moep90 and danieljanes authored Aug 24, 2024
1 parent 489247a commit 2612332
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/py/flwr/server/superlink/fleet/grpc_rere/fleet_servicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,30 @@ def CreateNode(
self, request: CreateNodeRequest, context: grpc.ServicerContext
) -> CreateNodeResponse:
"""."""
log(INFO, "FleetServicer.CreateNode")
log(INFO, "[Fleet.CreateNode] Request ping_interval=%s", request.ping_interval)
log(DEBUG, "[Fleet.CreateNode] Request: %s", request)
response = message_handler.create_node(
request=request,
state=self.state_factory.state(),
)
log(INFO, "FleetServicer: Created node_id=%s", response.node.node_id)
log(INFO, "[Fleet.CreateNode] Created node_id=%s", response.node.node_id)
log(DEBUG, "[Fleet.CreateNode] Response: %s", response)
return response

def DeleteNode(
self, request: DeleteNodeRequest, context: grpc.ServicerContext
) -> DeleteNodeResponse:
"""."""
log(INFO, "FleetServicer.DeleteNode")
log(INFO, "[Fleet.DeleteNode] Delete node_id=%s", request.node.node_id)
log(DEBUG, "[Fleet.DeleteNode] Request: %s", request)
return message_handler.delete_node(
request=request,
state=self.state_factory.state(),
)

def Ping(self, request: PingRequest, context: grpc.ServicerContext) -> PingResponse:
"""."""
log(DEBUG, "FleetServicer.Ping")
log(DEBUG, "[Fleet.Ping] Request: %s", request)
return message_handler.ping(
request=request,
state=self.state_factory.state(),
Expand All @@ -81,7 +84,8 @@ def PullTaskIns(
self, request: PullTaskInsRequest, context: grpc.ServicerContext
) -> PullTaskInsResponse:
"""Pull TaskIns."""
log(INFO, "FleetServicer.PullTaskIns")
log(INFO, "[Fleet.PullTaskIns] node_id=%s", request.node.node_id)
log(DEBUG, "[Fleet.PullTaskIns] Request: %s", request)
return message_handler.pull_task_ins(
request=request,
state=self.state_factory.state(),
Expand All @@ -91,7 +95,14 @@ def PushTaskRes(
self, request: PushTaskResRequest, context: grpc.ServicerContext
) -> PushTaskResResponse:
"""Push TaskRes."""
log(INFO, "FleetServicer.PushTaskRes")
if request.task_res_list:
log(
INFO,
"[Fleet.PushTaskRes] Push results from node_id=%s",
request.task_res_list[0].task.producer.node_id,
)
else:
log(INFO, "[Fleet.PushTaskRes] No task results to push")
return message_handler.push_task_res(
request=request,
state=self.state_factory.state(),
Expand All @@ -101,7 +112,7 @@ def GetRun(
self, request: GetRunRequest, context: grpc.ServicerContext
) -> GetRunResponse:
"""Get run information."""
log(INFO, "FleetServicer.GetRun")
log(INFO, "[Fleet.GetRun] Requesting `Run` for run_id=%s", request.run_id)
return message_handler.get_run(
request=request,
state=self.state_factory.state(),
Expand All @@ -111,7 +122,7 @@ def GetFab(
self, request: GetFabRequest, context: grpc.ServicerContext
) -> GetFabResponse:
"""Get FAB."""
log(DEBUG, "DriverServicer.GetFab")
log(INFO, "[Fleet.GetFab] Requesting FAB for fab_hash=%s", request.hash_str)
return message_handler.get_fab(
request=request,
ffs=self.ffs_factory.ffs(),
Expand Down

0 comments on commit 2612332

Please sign in to comment.