View Source Venomous.SnakeWorker (Venomous v0.1.1)
🔨🐍 A brave snake worker slithering across...
This module defines a GenServer that manages a snake worker, which interacts with a Python process to execute specified functions asynchronously.
The main :run_snake call, creates a Task.async/1
which calls python and handles exceptions returning python result or an Error struct which gets sent with signal to the caller process. This Task
gets awaited inside the :run cast(). The original call() returns :ok
Features
- Starts and initializes a Python process.
- Executes Python functions with given arguments.
- Handles the results of the Python function calls, including errors.
- Returns the result with a signal to caller process
Process Lifecycle
- On initialization, the worker starts a Python process.
- If provided, the worker initializes an encoder by calling a specified Python function with arguments.
- The worker can run Python functions on demand and return the results to the caller.
Summary
Functions
Returns a specification to start this module under a supervisor.
Callback implementation for GenServer.handle_continue/2
.
Callback implementation for GenServer.init/1
.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Callback implementation for GenServer.handle_continue/2
.
Callback implementation for GenServer.init/1
.