Snakepit.Pool.ProcessRegistry (snakepit v0.1.2)

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

This module maintains a mapping between:

  • Worker IDs
  • Elixir worker PIDs
  • External process PIDs
  • Process fingerprints

Enables robust orphaned process detection and cleanup.

Summary

Functions

Returns a specification to start this module under a supervisor.

Cleans up dead worker entries from the registry.

Gets all active external process PIDs from registered workers.

Gets all registered external process PIDs, regardless of worker status.

Gets registry statistics.

Gets information for a specific worker.

Gets workers with specific fingerprints.

Gets all registered worker information.

Registers a worker with its external process information.

Unregisters a worker from tracking.

Validates that all registered workers are still alive. Returns a list of dead workers that should be cleaned up.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

cleanup_dead_workers()

Cleans up dead worker entries from the registry.

get_active_process_pids()

Gets all active external process PIDs from registered workers.

get_all_process_pids()

Gets all registered external process PIDs, regardless of worker status.

This is useful during shutdown when workers may have been terminated but external processes still need cleanup.

get_stats()

Gets registry statistics.

get_worker_info(worker_id)

Gets information for a specific worker.

get_workers_by_fingerprint(fingerprint)

Gets workers with specific fingerprints.

list_all_workers()

Gets all registered worker information.

register_worker(worker_id, elixir_pid, process_pid, fingerprint)

Registers a worker with its external process information.

start_link(opts \\ [])

unregister_worker(worker_id)

Unregisters a worker from tracking.

validate_workers()

Validates that all registered workers are still alive. Returns a list of dead workers that should be cleaned up.