Skip to content

Commit

Permalink
change order of checks
Browse files Browse the repository at this point in the history
  • Loading branch information
SYangster committed Apr 16, 2024
1 parent 639d298 commit 5db10d8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions nvflare/app_common/ccwf/server_ctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,7 @@ def control_flow(self, abort_signal: Signal, fl_ctx: FLContext):

def handle_event(self, event_type: str, fl_ctx: FLContext):
if event_type == EventType.BEFORE_PROCESS_TASK_REQUEST:
peer_ctx = fl_ctx.get_peer_context()
if peer_ctx and self.workflow_id in peer_ctx.get_prop(Constant.STATUS_REPORTS, {}):
self._update_client_status(fl_ctx)
self._update_client_status(fl_ctx)

def process_config_reply(self, client_name: str, reply: Shareable, fl_ctx: FLContext) -> bool:
return True
Expand Down Expand Up @@ -441,10 +439,8 @@ def _check_job_status(self, fl_ctx: FLContext):
def _update_client_status(self, fl_ctx: FLContext):
peer_ctx = fl_ctx.get_peer_context()
assert isinstance(peer_ctx, FLContext)

client_name = peer_ctx.get_identity_name()
if client_name not in self.client_statuses:
self.log_error(fl_ctx, f"received result from unknown client {client_name}!")
return

# see whether status is available
reports = peer_ctx.get_prop(Constant.STATUS_REPORTS)
Expand All @@ -456,6 +452,10 @@ def _update_client_status(self, fl_ctx: FLContext):
if not my_report:
return

if client_name not in self.client_statuses:
self.log_error(fl_ctx, f"received result from unknown client {client_name}!")
return

report = status_report_from_dict(my_report)
cs = self.client_statuses[client_name]
assert isinstance(cs, ClientStatus)
Expand Down

0 comments on commit 5db10d8

Please sign in to comment.