View Source Venomous.SnakeManager (Venomous v0.1.0)

Manager for brave 🐍 workers

This module manages the snake workers, ensuring that inactive workers are cleaned up periodically.

Main call :get_ready_snake retrieves/spawns a Venomous.SnakeWorker with :busy/:spawned status. Workers with status :ready, :spawned, are considered inactive and will be cleared up by main process loop running :clean_inactive_workers if they exceed their given TTL

Configuration

The following configurations are retrieved from :venomous :snake_manager Application env:

  • erlport_encoder: %{module: atom(), func: atom(), args: list(any())}: Optional :erlport encoder/decoder python function for converting types.
  • snake_ttl_minutes: non_neg_integer(): Time-to-live for a Snake in minutes. Default is 15 min.
  • perpetual_workers: non_neg_integer(): Number of Snakes to keep alive perpetually. Default is 10.
  • cleaner_interval_ms: non_neg_integer(): Interval in milliseconds for cleaning up inactive Snakes. Default is 60_000 ms.

Defaults are provided in case these configurations are not set:

  • Default encoder: none.
  • Default time-to-live for a worker: 15 minutes.
  • Default number of perpetual workers: 10.
  • Default interval for cleaning inactive workers: 60,000 milliseconds.

Summary

Functions

Returns a specification to start this module under a supervisor.

Callback implementation for GenServer.init/1.

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

get_snake_worker_status(table, pid)

View Source
Link to this function

handle_continue(atom, state)

View Source

Callback implementation for GenServer.handle_continue/2.

Callback implementation for GenServer.init/1.