Architecture
Bizon Platform has three processes and one database:
| Component | Runs as | Role |
|---|---|---|
| API | python -m bizon_platform (FastAPI on port 8000) | REST API under /api, the cron scheduler, Git sync of custom sources |
| Worker | python -m bizon_platform.worker | Claims pending runs and executes them |
| UI | React app served by nginx (Vite in dev) | Calls the API through /api |
| Postgres | Postgres 16 | Pipelines, runs, saved connectors, and Bizon’s cursor backend |
Data model
Section titled “Data model”pipelines: name (unique), Bizon config, cron schedule,enabledflag, tags.pipeline_runs: status,triggered_by(manualorschedule), timestamps, error, log file path, output file.saved_connectors: reusable source and destination configs.
Pipeline and saved-connector configs are encrypted with Fernet using ENCRYPTION_KEY. Without a key, they are stored base64-encoded, which is not encryption.
Run lifecycle
Section titled “Run lifecycle”pending ──▶ running ──▶ success │ ├──────▶ failed └───────────┴──────▶ cancelled- A run is created as
pending, either byPOST /api/pipelines/{id}/runor by the scheduler. A pipeline can have only onependingorrunningrun at a time. - A worker claims the oldest pending run with
SELECT ... FOR UPDATE SKIP LOCKEDand marks itrunning. Several workers never pick the same run. - The worker replaces the config’s
engineblock with a Postgres backend that points at the platform database. Onlyengine.syncCursorInDBEveryfrom your config is kept. - The worker starts a Python subprocess that runs the pipeline with bizon-core. The subprocess inherits the worker’s environment variables.
- When the subprocess exits, the run becomes
successorfailed. A run that exits with code 0 is still markedfailedif its logs contain a line atERRORlevel.
Cancelling sets the status to cancelled. A running worker notices within a fraction of a second, sends SIGTERM, then SIGKILL after 5 seconds.
Each worker process runs one pipeline at a time. When it finds nothing to do, it waits WORKER_POLL_INTERVAL seconds before polling again.
Logs and outputs
Section titled “Logs and outputs”The worker captures the subprocess’s stderr and writes it every 2 seconds to:
{STORAGE_LOCAL_PATH}/logs/{pipeline_id}/{run_id}.logThe path is saved on the run when it finishes, so GET /api/pipelines/runs/{run_id}/logs returns null while the run is still in progress.
For pipelines with the file destination, the first data file the run produces is copied to {STORAGE_LOCAL_PATH}/{run_id}/ and can be downloaded from the API. .json files are renamed .jsonl.
The API and the workers must share STORAGE_LOCAL_PATH and CUSTOM_SOURCES_DIR. Docker Compose and the Helm chart both mount shared volumes for this.
Scheduler
Section titled “Scheduler”The scheduler is APScheduler running inside the API process. Every minute it checks the enabled pipelines that have a schedule and creates a pending run for each one that is due. See Scheduling.
Each API process runs its own scheduler. Run a single API replica, or two replicas can race to create the same scheduled run.
Scaling
Section titled “Scaling”Add workers to run more pipelines in parallel:
docker compose --profile prod up -d --scale worker=4On Kubernetes, set worker.replicaCount or enable worker.autoscaling. See Kubernetes.