CLI usage
Operate the queue from the terminal with the flexiq command — workers, dashboard, migrations, scaling.
Operate the queue from the terminal with the flexiq command — workers, dashboard, migrations, scaling.
The flexiq command is installed with the package and is the supported way to
run workers in production. Unlike a DSN-driven admin tool, it imports your
application: --app module:attribute names the Queue instance, so every
command sees exactly the tasks, resources and backend your code configured.
flexiq worker --app myapp.tasks:queue --queues emails,media
flexiq info --app myapp.tasks:queue --watch
flexiq pause --app myapp.tasks:queue emails
flexiq resume --app myapp.tasks:queue emailsThe module must be importable from the working directory — installed as a
package, or with its parent on PYTHONPATH.
worker is what you point a container entrypoint or a systemd unit at. It
blocks until interrupted and shuts down gracefully: SIGTERM (or Ctrl+C)
stops new claims and lets in-flight jobs finish.
flexiq worker --app myapp.tasks:queue --queues emails,media \
--pool prefork --drain-timeout 60| Flag | Default | Why you'd set it |
|---|---|---|
--queues | all registered | Give a workload its own process — a slow queue then can't starve a fast one. |
--pool | thread | prefork runs child processes with independent GILs, for CPU-bound tasks. |
--drain-timeout | 30 | Seconds to let in-flight jobs finish on shutdown. Raise it above your longest task, or a deploy turns into duplicate execution. |
Set the supervisor's own kill deadline above --drain-timeout; see
Deployment.
flexiq dashboard --app myapp.tasks:queue --host 127.0.0.1 --port 8080 --authBinds to loopback by default. --auth turns on session authentication (login,
CSRF, roles); without it the dashboard serves openly, so only ever do that
behind a network boundary — see
Dashboard.
A queue applies pending DDL when it opens. Where the application's database
credentials can't do DDL, turn that off (Queue(auto_migrate=False)) and apply
the schema explicitly on deploy — the command is idempotent:
flexiq migrate --app myapp.tasks:queueIt reports what it applied, core and workflow tables both, and says so when there was nothing to do.
# Queue-depth metrics endpoint for KEDA
flexiq scaler --app myapp.tasks:queue --host 0.0.0.0 --port 9091 --target-queue-depth 5
# Or spawn and drain worker processes directly, without Kubernetes
flexiq autoscale --app myapp.tasks:queue --min-workers 2 --max-workers 20scaler binds loopback by default, so KEDA — which scrapes it from another pod
— needs --host 0.0.0.0. That listener answers anything that can route to it
and has no auth of its own, so put the boundary in the cluster: a
ClusterIP Service and a NetworkPolicy that admits only the KEDA operator.
See KEDA and Autoscaling.
flexiq resources --app myapp.tasks:queue # scope, health, init time, dependencies
flexiq reload --pid 12345 # SIGHUP a worker to rebuild its resourcesreload re-initialises a running worker's resources without restarting the
process — useful after rotating a credential. Add --resource <name> to reload
one. Background in the resource system.
flexiq executor --app myapp.tasks:queue --attach host:port runs task bodies
for a detached scheduler and needs no database credentials of its own — see
Attached Executors.
Every flag of every command is in the CLI reference.