Temporal Configuration
Marqov uses Temporal for durable workflow execution. Workflows defined with @task/@workflow decorators are dispatched to Temporal for parallel execution, retry handling, and observability.
Local Development
Use the provided Docker Compose file at docker/docker-compose.yml:
cd docker
docker-compose up -dThis starts four services:
| Service | Container | Port | Description |
|---|---|---|---|
postgresql | marqov-postgresql | 5432 | PostgreSQL 15 for Temporal persistence |
temporal | marqov-temporal | 7233 | Temporal server (gRPC frontend) |
temporal-ui | marqov-temporal-ui | 8088 | Temporal Web UI |
temporal-admin-tools | marqov-temporal-admin | — | CLI admin tools (interactive) |
Local environment variables:
TEMPORAL_ADDRESS=localhost:7233
TEMPORAL_NAMESPACE=default
NEXT_PUBLIC_TEMPORAL_UI_URL=http://localhost:8088The Temporal UI is available at http://localhost:8088 and provides workflow visualization, history inspection, and debugging tools.
Stopping Services
cd docker
docker-compose down # Stop containers, keep volumes
docker-compose down -v # Stop containers and delete volumes (resets state)Temporal Cloud (Production)
For production, use Temporal Cloud instead of self-hosted Temporal.
Required environment variables:
| Variable | Description | Example |
|---|---|---|
TEMPORAL_ADDRESS | Temporal Cloud gRPC endpoint | your-namespace.tmprl.cloud:7233 |
TEMPORAL_NAMESPACE | Cloud namespace name | your-namespace.xxxxx |
TEMPORAL_API_KEY | API key for authentication | eyJ... |
Temporal Cloud uses TLS by default. The worker SDK auto-negotiates the connection when TEMPORAL_API_KEY is set.
Namespace Configuration
Temporal organizes workflows into namespaces. Marqov uses:
| Environment | Namespace | Purpose |
|---|---|---|
| Local | default | Development and testing |
| Production | Configured via TEMPORAL_NAMESPACE | Production workflows |
Creating a Namespace (Local)
The temporalio/auto-setup Docker image creates the default namespace automatically. To create additional namespaces:
docker exec -it marqov-temporal-admin tctl namespace register --namespace my-namespaceTask Queues
Marqov uses the marqov-workflows task queue for all workflow execution. This is the default in WorkflowDispatch.run() and create_worker().
| Queue | Purpose |
|---|---|
marqov-workflows | All @task/@workflow executions |
Worker Configuration
The Marqov worker registers the JobWorkflow workflow class and execute_task activity with Temporal. Start a worker:
from temporalio.client import Client
from marqov.workflows import create_worker
client = await Client.connect("localhost:7233")
worker = await create_worker(client, task_queue="marqov-workflows")
await worker.run()In production, the platform worker (platform/src/platform_worker.py) handles worker lifecycle automatically.
Dynamic Configuration
The Docker Compose setup mounts docker/temporal-config/ into the Temporal container at /etc/temporal/config/dynamicconfig/. Place a development.yaml file there to override Temporal server defaults.
Workflow Execution Model
- A
@workflowfunction is called, building aTransportGraphof@tasknodes. WorkflowDispatch.run(client)serializes the graph as JSON and starts a Temporal workflow.- The
JobWorkflowexecutes tasks level-by-level, running independent tasks in parallel. - Each task is executed as a Temporal activity (
execute_task), which deserializes the function viacloudpickleand runs it. - Results are collected and returned as JSON.
Sandbox restriction: Temporal’s workflow sandbox prevents importing marqov directly in workflow modules. Tasks handle all marqov-dependent logic. The workflow module receives pre-serialized, pure-JSON inputs only.