aistore.sdk.etl.webserver.http_multi_threaded_server

View as Markdown

Module Contents

Classes

NameDescription
HTTPMultiThreadedServerMulti-threaded HTTP server implementation for ETL payload transformation.
ThreadedHTTPServerMulti-threaded HTTP server that delegates ETL logic to a provided ETLServer instance.
_RFileLimitedReaderBound BaseHTTPRequestHandler.rfile to the current PUT body length.

API

class aistore.sdk.etl.webserver.http_multi_threaded_server.HTTPMultiThreadedServer(
host: str = '0.0.0.0',
port: int = 8000
)

Bases: ETLServer

Multi-threaded HTTP server implementation for ETL payload transformation. Handles GET and PUT requests via a request handler class.

aistore.sdk.etl.webserver.http_multi_threaded_server.HTTPMultiThreadedServer.start()

Starts the HTTP server and gracefully handles SIGTERM/SIGINT for Kubernetes.

class aistore.sdk.etl.webserver.http_multi_threaded_server.ThreadedHTTPServer(
server_address: typing.Tuple[str, int],
handler_class: typing.Type[http.server.BaseHTTPRequestHandler],
etl_server: aistore.sdk.etl.webserver.base_etl_server.ETLServer
)

Bases: ThreadingMixIn, HTTPServer

Multi-threaded HTTP server that delegates ETL logic to a provided ETLServer instance.

class aistore.sdk.etl.webserver.http_multi_threaded_server._RFileLimitedReader(
rfile: typing.BinaryIO,
content_length: int
)

Bases: RawIOBase

Bound BaseHTTPRequestHandler.rfile to the current PUT body length.

self.rfile is the raw connection stream; it has no intrinsic EOF at the end of this request body. Passing it directly to transform_stream would cause any transform that calls reader.read() with no size argument to block indefinitely waiting for the client to close the connection.

This wrapper tracks Content-Length remaining bytes and clamps every read() call accordingly, giving transforms the same EOF semantics they get from a BytesIO — without buffering the full body upfront.

The request body is one-shot; _direct_put_stream_with_retry sets effective_retries=0 on this path. close() drains any unread bytes from the request body so a transform that exits early does not leave residual data on a keep-alive connection.

aistore.sdk.etl.webserver.http_multi_threaded_server._RFileLimitedReader.close() -> None
aistore.sdk.etl.webserver.http_multi_threaded_server._RFileLimitedReader.read(
size: int = -1
) -> bytes
aistore.sdk.etl.webserver.http_multi_threaded_server._RFileLimitedReader.readable() -> bool