View Source Venomous.SnakeManager (Venomous v0.7.7)

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 :retrieved status. Workers with status :ready and :retrieved are considered inactive and will be cleared up by main process loop running :clean_inactive_workers if they exceed their given TTL Workers with :retrieved retrieved again until they are used.

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. The function can also provide any callbacks from :erlport documentation like .cast() message handler
  • 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: non_neg_integer(): Interval in milliseconds for cleaning up inactive Snakes. Default is 60_000 ms.

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.