Snakepit.RunID (Snakepit v0.13.0)

Copy Markdown View Source

Generates short, unique BEAM run identifiers.

Format: 7 characters, base36-encoded Components: timestamp (5 chars) + counter (2 chars) Example: "k3x9a2p"

These IDs are embedded in Python process command lines for reliable identification and cleanup across BEAM restarts.

Summary

Functions

Extracts run ID from a process command line. Supports both --snakepit-run-id and --run-id formats.

Generates a unique 7-character run ID.

Functions

extract_from_command(command)

Extracts run ID from a process command line. Supports both --snakepit-run-id and --run-id formats.

Examples

iex> cmd = "python3 grpc_server.py --snakepit-run-id k3x9a2p --port 50051"
iex> Snakepit.RunID.extract_from_command(cmd)
{:ok, "k3x9a2p"}

iex> Snakepit.RunID.extract_from_command("no run id here")
{:error, :not_found}

generate()

Generates a unique 7-character run ID.

Examples

iex> run_id = Snakepit.RunID.generate()
iex> String.length(run_id)
7