← Về thư mục
openai4s/kernel/transport.py
- KernelTransport · class · L63-L93 — class KernelTransport(Protocol)
- write_line · method · L66-L66 — def write_line(self, line: str) -> None
- read_line · method · L68-L70 — def read_line(self) -> str
- alive · method · L72-L72 — def alive(self) -> bool
- interrupt · method · L74-L77 — def interrupt(self) -> bool
- kill · method · L79-L79 — def kill(self) -> None
- close · method · L81-L81 — def close(self, *, graceful: bool = True) -> None
- process · method · L84-L87 — def process(self) -> Any
- stderr_tail · method · L90-L93 — def stderr_tail(self) -> Any
- _reset_inherited_signal_dispositions · function · L96-L123 — def _reset_inherited_signal_dispositions() -> None
- _process_spawner · function · L142-L149 — def _process_spawner() -> ThreadPoolExecutor
- _spawn_process · function · L152-L164 — def _spawn_process(command: list[str], options: dict[str, Any]) -> subprocess.Popen
- PipeTransport · class · L167-L417 — class PipeTransport
- init · method · L175-L270 — def init( self, command: list[str], *, cwd: str | None, env: dict[str, str], stderr_tail_factory: Callable[[], Any] | None = None, pass_fds: tuple[int, ...] = (), process_started: Callable[[int], None] | None = None, ) -> None
- _start_stderr_drain · method · L272-L307 — def _start_stderr_drain(self) -> None: # Drain stderr continuously into a bounded tail. Without this, a cell # whose child processes write to inherited fd2 (R
system(), an # uncaptured subprocess in python) fills the 64KB pipe and deadlocks # the cell forever — nothing used to read stderr until worker death. # The tail keeps the death diagnostics the old blocking read provided. # # Bounded in BYTES, at the read: a line COUNT applied after the # allocation is no bound at all when one producer emits a single # enormous line, which is exactly what reaches here. # # os.read on the descriptor, not BufferedReader.read. Both give # bytes, and only one of them is safe: this thread is a daemon, and a # daemon parked inside a buffered read holds that buffer's lock when # the interpreter finalises — a clean exit turned into SIGABRT by the # drain alone. os.read also returns as soon as anything is # available, which is what a drain wants.
- _drain · function · L295-L305 — def _drain(fd: int = stderr_fd, sink=tail) -> None
- write_line · method · L311-L314 — def write_line(self, line: str) -> None
- read_line · method · L316-L318 — def read_line(self) -> str
- alive · method · L322-L323 — def alive(self) -> bool
- interrupt · method · L325-L329 — def interrupt(self) -> bool
- _stop_group_or_leader · method · L331-L370 — def _stop_group_or_leader(self) -> None
- kill · method · L372-L373 — def kill(self) -> None
- close · method · L375-L409 — def close(self, *, graceful: bool = True) -> None
- process · method · L412-L413 — def process(self) -> Any
- stderr_tail · method · L416-L417 — def stderr_tail(self) -> Any
- WorkerConnectionRefused · class · L420-L421 — class WorkerConnectionRefused(RuntimeError)
- OutboundTcpTransport · class · L424-L556 — class OutboundTcpTransport
- init · method · L432-L455 — def init( self, sock: socket.socket, *, peer: str = "", interrupt_hook: Callable[[], bool] | None = None, remote_pid: int | None = None, ) -> None
- write_line · method · L457-L460 — def write_line(self, line: str) -> None
- read_line · method · L462-L484 — def read_line(self) -> str
- alive · method · L486-L496 — def alive(self) -> bool
- interrupt · method · L498-L508 — def interrupt(self) -> bool
- kill · method · L510-L513 — def kill(self) -> None
- close · method · L515-L538 — def close(self, *, graceful: bool = True) -> None
- process · method · L541-L545 — def process(self) -> Any
- stderr_tail · method · L548-L552 — def stderr_tail(self) -> Any
- remote_pid · method · L555-L556 — def remote_pid(self) -> int | None