Skip to content

Commit

Permalink
Added debug info for memoryview error (#2908)
Browse files Browse the repository at this point in the history
* Added debug info for memoryview errors

* Fixed formatting issues
  • Loading branch information
nvidianz authored Sep 5, 2024
1 parent ef3ef4b commit 3a9a657
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
17 changes: 12 additions & 5 deletions nvflare/fuel/f3/streaming/blob_streamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,17 @@ def _read_stream(blob_task: BlobTask):
break

length = len(buf)
if blob_task.pre_allocated:
blob_task.buffer[buf_size : buf_size + length] = buf
else:
blob_task.buffer.append(buf)
try:
if blob_task.pre_allocated:
blob_task.buffer[buf_size : buf_size + length] = buf
else:
blob_task.buffer.append(buf)
except Exception as ex:
log.error(
f"memory view error: {ex} "
f"Debug info: {length=} {buf_size=} {len(blob_task.pre_allocated)=} {type(buf)=}"
)
raise ex

buf_size += length

Expand All @@ -129,7 +136,7 @@ def _read_stream(blob_task: BlobTask):
blob_task.future.set_result(result)
except Exception as ex:
log.error(f"Stream {blob_task.future.get_stream_id()} read error: {ex}")
log.debug(secure_format_traceback())
log.error(secure_format_traceback())
blob_task.future.set_exception(ex)


Expand Down
5 changes: 5 additions & 0 deletions nvflare/private/aux_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ def dispatch(self, topic: str, request: Shareable, fl_ctx: FLContext) -> Shareab
Returns: reply message
"""

if not isinstance(request, Shareable):
self.log_error(fl_ctx, f"received invalid aux request: expects a Shareable but got {type(request)}")
return make_reply(ReturnCode.BAD_REQUEST_DATA)

peer_props = request.get_peer_props()
if peer_props:
peer_ctx = FLContext()
Expand Down

0 comments on commit 3a9a657

Please sign in to comment.