Skip to content

python/etl: stream HTTPMultiThreadedServer no-FQN hpush PUT#293

Open
chanu1406 wants to merge 1 commit intoNVIDIA:mainfrom
chanu1406:http-stream-put-no-fqn
Open

python/etl: stream HTTPMultiThreadedServer no-FQN hpush PUT#293
chanu1406 wants to merge 1 commit intoNVIDIA:mainfrom
chanu1406:http-stream-put-no-fqn

Conversation

@chanu1406
Copy link
Copy Markdown
Contributor

Follow up to #289 — stream no-FQN hpush PUT requests in HTTPMultiThreadedServer in constant memory.

Previously _get_stream_reader buffered the full request body into a BytesIO before transform_stream ran. For large objects this is the same OOM-at-scale concern the GET-side fix addressed.

The HTTP server case is simpler than the async FastAPI side: self.rfile is already a sync BinaryIO, so there's no async/sync bridge needed. The fix is a thin length-bounded wrapper (_RFileLimitedReader) that gives transform_stream the correct EOF semantics without the full-body allocation.

Changes:

  • _RFileLimitedReader: sync io.RawIOBase subclass that clamps read() to Content-Length remaining bytes
  • _direct_put_stream_with_retry: gate retries on replayability (bool(fqn) or is_get); no-FQN PUT bodies are one-shot so local retries are skipped and a transient direct-put error surfaces to AIS as a transform failure
  • Tests: 4 new reader-behavior tests, 3 new retry-gate tests, 3 existing tests converted to the replayable GET path, 3 BytesIO-seek-replay tests retired

@chanu1406 chanu1406 requested a review from alex-aizman as a code owner May 6, 2026 19:49
- add _RFileLimitedReader: bounded sync reader around self.rfile so transform_stream sees correct EOF without buffering the full body
- gate _direct_put_stream_with_retry retries on replayability (bool(fqn) or is_get); skip local retries for one-shot no-FQN PUT bodies
- retire BytesIO-seek replay tests; convert three existing retry tests to the replayable GET path

Signed-off-by: Chanu Ollala <chanuollala@gmail.com>
@chanu1406 chanu1406 force-pushed the http-stream-put-no-fqn branch from 773bb8b to bb7dbf7 Compare May 7, 2026 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant