API Reference Snakepit v#0.13.0

Copy Markdown View Source

Modules

Snakepit - A generalized high-performance pooler and session manager.

Behaviour for implementing adapters in Snakepit.

gRPC-based Python adapter for Snakepit.

Application supervisor for Snakepit pooler.

Provisioning workflow for development and CI environments.

Behaviour for executing bootstrap steps. Allows tests to inject fakes.

Internal specification for a tool in the registry. Separate from the protobuf ToolSpec to avoid conflicts.

Session data structure for centralized session management.

Centralized session store using ETS for high-performance session management.

Registry for managing tool metadata and execution.

Circuit breaker for Python worker fault tolerance.

Thread-safety compatibility matrix for common Python libraries.

Configuration management for Snakepit pools.

Crash barrier policy for worker failures.

Centralized defaults for all configurable values in Snakepit.

Centralized owner of shared ETS tables used by Snakepit.

Environment diagnostics for the Python bridge.

Structured error type for Snakepit operations.

Device error creation helpers.

Device mismatch error for tensor operations.

Out of memory error for GPU operations.

Parses Python exception data into structured Elixir errors.

Shape error creation helpers.

Shape mismatch error for tensor operations.

Execution helpers with retry, circuit breaker, and timeout support.

gRPC server implementation for the Snakepit Bridge service.

gRPC client for the unified bridge protocol. Delegates to the real implementation when available.

Real gRPC client implementation using generated stubs.

gRPC endpoint for the Snakepit bridge server.

A GenServer that manages gRPC connections to external processes.

Hardware abstraction layer for Snakepit.

CPU hardware detection.

CUDA GPU hardware detection.

Unified hardware detection module.

Apple Metal Performance Shaders (MPS) hardware detection.

AMD ROCm GPU hardware detection.

Device selection logic for hardware abstraction.

Monitors worker health and crash patterns.

Monitors a worker process using a configurable heartbeat protocol.

Supervised task helpers with automatic fallback to bare monitors.

Telemetry-based deprecation tracking for legacy modules.

Bounded-time function execution using spawn_monitor and receive.

Centralized, silent-by-default logging for Snakepit.

Structured error for Python package installation and inspection.

Pool manager for external workers with concurrent initialization.

Provides hard guarantees for worker process cleanup when the application exits.

Registry for tracking external worker processes with OS-level PID management.

Registry for pool worker processes.

Supervisor wrapper for individual workers that provides automatic restart capability.

Registry for worker starter supervisors.

DynamicSupervisor for pool worker processes.

Robust OS process management using Erlang primitives. No shell commands, pure Erlang/Elixir.

Package installation and inspection for Snakepit-managed Python runtimes.

Resolve and manage the Python runtime used by Snakepit.

Normalizes Python threading configuration with safe defaults.

Detects the active Python runtime version and recommends worker profiles.

Retry policy with exponential backoff.

Generates short, unique BEAM run identifiers.

Deterministic shutdown cleanup for external worker processes.

Utilities for working with Snakepit's serialization layer.

Telemetry event definitions for Snakepit.

Helper functions for creating telemetry control messages.

Utilities for generating and propagating correlation identifiers.

ML-specific telemetry event definitions.

GPU memory and utilization profiler.

Manages gRPC telemetry streams from Python workers.

Telemetry handler that logs ML-related events.

Telemetry metrics definitions for ML-related events.

Event catalog and naming validation for Snakepit telemetry.

Bootstraps OpenTelemetry tracing and telemetry bridges for Snakepit.

Safe metadata handling for telemetry events.

Telemetry span helpers for wrapping operations.

Telemetry metric definitions and reporters for Snakepit.

Canonical configuration for lifecycle-managed workers.

Worker lifecycle manager for automatic recycling and health monitoring.

Tracks tainted workers and devices after crash classification.

Behaviour for worker profiles (process vs thread).

Multi-process worker profile (default).

Multi-threaded worker profile (Python 3.13+ optimized).

Zero-copy interop helpers for DLPack and Arrow.

Opaque handle for zero-copy payloads.

Mix Tasks

Diagnose the local Python and gRPC tooling required by Snakepit.

Generate a Python adapter skeleton under priv/python.

Bootstraps the Snakepit Python environment and runs the Python test suite.

Bootstrap the Snakepit development environment.

Report the current status of Snakepit pools and worker queues.