Run Python workers under Portals.
This package bundles the dependency-free Python worker SDK (the portals
Python package) and puts it on the worker's PYTHONPATH, so a worker
script can simply from portals import Worker — nothing is installed with
pip.
children = [
{Portals.Pool,
Portals.Python.worker_opts(
script: Application.app_dir(:my_app, "priv/python/worker.py"),
name: MyApp.Python,
size: 4
)}
]See the Python guide for a full walkthrough.
Summary
Functions
Build Portals.start_worker/1 / Portals.start_pool/1 options for a
Python worker script.
Functions
Build Portals.start_worker/1 / Portals.start_pool/1 options for a
Python worker script.
Options
:script(required) — path to the worker entry script, which callsportals.Worker(...).run().:python— the interpreter, as a name looked up onPATHor a path such as".venv/bin/python". Defaults to"python3".:python_args— interpreter flags placed before the script, e.g.["-X", "dev"].:args— arguments passed to the script. Portals appends the socket path after these, as the last argument.:env— extra{name, value}environment entries; these win over the ones set here.
Every other option (:name, :size, :max_overflow, :limits, ...) is
passed through unchanged.
The SDK directory is prepended to any PYTHONPATH already set in the
BEAM's environment.