Anuva Python Server User Guide
This guide covers local manual render-job smoke tests against the implemented Anuva Web App at http://localhost:3000, plus the existing simulator launchers for development-only flows.
Before You Start
For real Web App testing, confirm all of these first:
- The Anuva Web App is running at
http://localhost:3000. - The Web App has
ANUVA_WORKER_API_TOKENconfigured. - The Web App database migrations required by the worker API have been applied.
- S3 signing is configured in the Web App, because the worker uses the signed upload flow.
- At least one
video_generation_jobsrecord is queued. - The worker machine uses the same
ANUVA_WORKER_API_TOKENvalue as the Web App. The new Web App launchers default this toanuva-worker-api-tokenif it is not already set. - The repo-local
.venvexists and dependencies are installed.
Useful environment setup from PowerShell:
$env:ANUVA_WORKER_API_TOKEN = "anuva-worker-api-token"
$env:ANUVA_DASHBOARD_TOKEN = "local-dev-dashboard-token"
The worker expects Unity/Vuplex assets to be served locally over HTTPS, so generate the localhost certificate before the first run:
.\.venv\Scripts\python.exe -m anuva_python_server.cli cert generate-local --config C:/Anuva/Worker/config/manual-webapp-editor.yaml
Manual Web App + Unity Editor Test
Use this flow when the Anuva Web App is the job source and Unity runs in Editor Play Mode.
Config
Save this as C:/Anuva/Worker/config/manual-webapp-editor.yaml:
worker:
id: "unity-editor-worker-01"
root_dir: "C:/Anuva/Worker"
jobs:
acquisition_mode: "manual"
list_available_limit: 25
allow_manual_claim_when_busy: false
webapp:
mode: "real"
base_url: "http://localhost:3000"
api_token_env: "ANUVA_WORKER_API_TOKEN"
timeout_sec: 30
simulator:
enabled: false
unity:
mode: "editor"
require_existing_connection: true
startup_timeout_sec: 120
heartbeat_timeout_sec: 30
render_timeout_sec: 1800
zmq:
host: "127.0.0.1"
command_port: 5560
status_port: 5561
heartbeat_port: 5562
receive_timeout_ms: 2000
servers:
content:
host: "127.0.0.1"
port: 7443
https: true
cert_file: "C:/Anuva/Worker/certs/localhost.crt"
key_file: "C:/Anuva/Worker/certs/localhost.key"
dashboard:
host: "127.0.0.1"
port: 7080
https: false
admin_token_env: "ANUVA_DASHBOARD_TOKEN"
upload:
strategy: "signed_s3"
logging:
level: "INFO"
json_logs: true
log_dir: "C:/Anuva/Worker/logs"
retain_days: 14
One-Command Server Startup
Run this from the repository root:
The launcher will:
- Default
ANUVA_WORKER_API_TOKENtoanuva-worker-api-tokenif it is not already set. - Validate
C:/Anuva/Worker/config/manual-webapp-editor.yaml. - Check that local worker ports
5561,5562,7080, and7443are free. - Generate the localhost HTTPS certificate if needed.
- Start the content server in a new Command Prompt window.
- Start the dashboard in a new Command Prompt window.
Then open:
The default dashboard token is:
To use a different config path:
Manual Server Startup
Use these commands only when you want to start each process yourself:
$config = "C:/Anuva/Worker/config/manual-webapp-editor.yaml"
.\.venv\Scripts\python.exe -m anuva_python_server.cli validate-config --config $config
.\.venv\Scripts\python.exe -m anuva_python_server.cli cert generate-local --if-missing --config $config
Start-Process powershell -ArgumentList '-NoExit', '-Command', ".\.venv\Scripts\python.exe -m anuva_python_server.cli content --config $config"
Start-Process powershell -ArgumentList '-NoExit', '-Command', ".\.venv\Scripts\python.exe -m anuva_python_server.cli dashboard --config $config"
Unity Editor Setup
In Unity Editor Play Mode, use the same localhost ZeroMQ topology:
Command REP bind: tcp://127.0.0.1:5560
Status PUSH connect: tcp://127.0.0.1:5561
Heartbeat PUSH connect: tcp://127.0.0.1:5562
Content base URL: https://127.0.0.1:7443
Do not press Play too early if Unity only emits unity.ready once at startup. Start the manual run first, then press Play so the worker is already waiting for readiness.
Running A Manual Job
- Open the dashboard.
- Enter
local-dev-dashboard-tokenin the token field. - Confirm the queued job appears in Available Web App Jobs.
- Select Run for that job.
- When the Dashboard shows the run waiting for Unity readiness, press Play in Unity Editor.
The worker will:
- Atomically claim the selected Web App job.
- Download the render package from
/api/worker/v1/jobs/{jobId}/package. - Download and rewrite assets into the local workspace.
- Send
render.startto Unity. - Forward progress to the Web App with
PATCH /api/worker/v1/jobs/{jobId}/status. - Validate
final.mp4. - Generate a thumbnail.
- Request a signed S3 upload target.
- Upload the MP4 to S3.
- Confirm the upload with the Web App.
- Complete the job in the Web App.
You can run the same lifecycle from the CLI:
.\.venv\Scripts\python.exe -m anuva_python_server.cli run-manual-job --config $config --job-id <queued-job-id>
When using the CLI in editor mode, press Play after the command begins waiting for Unity readiness.
Expected Local Workspace
The job workspace should look like:
C:/Anuva/Worker/jobs/<job-id>/presentation_config.local.json
C:/Anuva/Worker/jobs/<job-id>/job_manifest.json
C:/Anuva/Worker/jobs/<job-id>/assets/...
C:/Anuva/Worker/jobs/<job-id>/output/
Manual Web App + Unity EXE Test
Use this flow when the Anuva Web App is the job source and the Python worker launches or connects to the built Unity player.
Config
Save this as C:/Anuva/Worker/config/manual-webapp-exe.yaml, then update unity.executable_path and unity.working_directory:
worker:
id: "unity-exe-worker-01"
root_dir: "C:/Anuva/Worker"
jobs:
acquisition_mode: "manual"
list_available_limit: 25
allow_manual_claim_when_busy: false
webapp:
mode: "real"
base_url: "http://localhost:3000"
api_token_env: "ANUVA_WORKER_API_TOKEN"
timeout_sec: 30
simulator:
enabled: false
unity:
mode: "exe"
executable_path: "C:/Anuva/Unity/AnuvaVideoGenerator.exe"
working_directory: "C:/Anuva/Unity"
launch_args: []
startup_timeout_sec: 120
heartbeat_timeout_sec: 30
render_timeout_sec: 1800
zmq:
host: "127.0.0.1"
command_port: 5560
status_port: 5561
heartbeat_port: 5562
receive_timeout_ms: 2000
servers:
content:
host: "127.0.0.1"
port: 7443
https: true
cert_file: "C:/Anuva/Worker/certs/localhost.crt"
key_file: "C:/Anuva/Worker/certs/localhost.key"
dashboard:
host: "127.0.0.1"
port: 7080
https: false
admin_token_env: "ANUVA_DASHBOARD_TOKEN"
upload:
strategy: "signed_s3"
logging:
level: "INFO"
json_logs: true
log_dir: "C:/Anuva/Worker/logs"
retain_days: 14
One-Command Server Startup
Run this from the repository root:
To use a different config path:
The launcher starts the content server and dashboard only. The Anuva Web App must already be running separately at http://localhost:3000.
Open:
Running A Manual Job
In the Dashboard:
- Select Launch Unity.
- Wait for the Unity panel to show
ready: true. - Select Run for a queued Web App job.
In EXE mode, the worker refuses the run before claim if Unity is not already ready. That keeps the Web App job queued instead of claiming it too early.
The Unity panel should show mode: exe. The Launch Unity, Restart, and Stop controls are visible only in EXE mode.
The worker appends these arguments to the Unity command line:
--anuva-worker-id
--anuva-zmq-host
--anuva-zmq-command-port
--anuva-zmq-status-port
--anuva-zmq-heartbeat-port
--anuva-local-server
--anuva-mode worker
The Unity EXE should use those values to emit unity.ready, accept render.start, and report progress over the same localhost ZeroMQ ports used by editor mode.
You can also run the full lifecycle from the CLI:
$config = "C:/Anuva/Worker/config/manual-webapp-exe.yaml"
.\.venv\Scripts\python.exe -m anuva_python_server.cli run-manual-job --config $config --job-id <queued-job-id>
Diagnostics
For real Web App runs, inspect:
C:/Anuva/Worker/jobs/<job-id>/job_manifest.json
C:/Anuva/Worker/jobs/<job-id>/logs/zmq_messages.jsonl
C:/Anuva/Worker/jobs/<job-id>/diagnostics/system_snapshot_start.json
C:/Anuva/Worker/jobs/<job-id>/diagnostics/system_snapshot_end.json
C:/Anuva/Worker/logs
For EXE mode, also inspect:
If a job is visible in the Web App but not in the Dashboard, check:
- The job is still in
queued. ANUVA_WORKER_API_TOKENmatches the Web App token. The Web App launchers default it toanuva-worker-api-token, so the Web App should use that same value unless you intentionally override it.GET /api/worker/v1/jobs/availableis enabled and reachable.- The Web App worker collections and migrations are present.
Simulator Launchers Still Available
The simulator launchers are still useful when you want a fully local worker + fake Web App flow:
Those launchers start the simulator on http://127.0.0.1:7090, seed happy_path_final_render, and keep the old development-only workflow available without the real Web App.