Config section key: tasks — loaded from tasks: in application.yaml or via LEX_TASKS__* environment variables.
redis_url: "${REDIS_URL}"
redis_url: "${REDIS_URL}"
| Key | Type | Default | Env Var | Description |
|---|
name | str | "tasks" | LEX_TASKS__NAME | Configuration name |
enabled | bool | True | LEX_TASKS__ENABLED | Whether tasks module is enabled |
env | str | None | None | LEX_TASKS__ENV | Environment label (development/staging/production) |
backend | TaskBackendConfig | {} | (prefix) | Task queue backend config |
worker | TaskWorkerConfig | {} | (prefix) | Worker settings |
scheduler | TaskSchedulerConfig | {} | (prefix) | Scheduler settings |
retry | RetryConfig | {} | (prefix) | Retry policy |
rate_limit | TaskRateLimitConfig | {} | (prefix) | Rate limiting |
timeout | TaskTimeoutConfig | {} | (prefix) | Timeout settings |
extra | dict[str, Any] | {} | LEX_TASKS__EXTRA__* | Extra arbitrary config |
backends | list[NamedTaskConfig] | [] | (list) | Named multi-backend queues |
| Key | Type | Default | Env Var | Description |
|---|
type | str | "memory" | LEX_TASKS__BACKEND__TYPE | Backend type: memory, redis, rabbitmq, postgres |
redis_url | SecretStr | "redis://localhost:6379" | LEX_TASKS__BACKEND__REDIS_URL | Redis connection URL |
amqp_url | SecretStr | "amqp://localhost:5672/" | LEX_TASKS__BACKEND__AMQP_URL | AMQP connection URL |
postgres_dsn | SecretStr | None | None | LEX_TASKS__BACKEND__POSTGRES_DSN | Postgres DSN (for type: postgres) |
queue_name | str | "tasks" | LEX_TASKS__BACKEND__QUEUE_NAME | Queue name |
| Key | Type | Default | Env Var | Description |
|---|
worker_count | int | 1 | LEX_TASKS__WORKER__WORKER_COUNT | Number of worker instances |
max_concurrent_tasks | int | 10 | LEX_TASKS__WORKER__MAX_CONCURRENT_TASKS | Max concurrent tasks per worker |
poll_interval | float | 0.1 | LEX_TASKS__WORKER__POLL_INTERVAL | Queue poll interval (seconds) |
shutdown_timeout | float | 30.0 | LEX_TASKS__WORKER__SHUTDOWN_TIMEOUT | Graceful shutdown timeout (seconds) |
default_timeout | float | 300.0 | LEX_TASKS__WORKER__DEFAULT_TIMEOUT | Default task timeout (seconds) |
max_timeout | float | 3600.0 | LEX_TASKS__WORKER__MAX_TIMEOUT | Maximum allowed timeout (seconds) |
enforce_timeout | bool | True | LEX_TASKS__WORKER__ENFORCE_TIMEOUT | Enforce timeouts on all tasks |
| Key | Type | Default | Env Var | Description |
|---|
enabled | bool | True | LEX_TASKS__SCHEDULER__ENABLED | Enable job scheduling |
check_interval | float | 1.0 | LEX_TASKS__SCHEDULER__CHECK_INTERVAL | Schedule check interval (seconds) |
timezone | str | "UTC" | LEX_TASKS__SCHEDULER__TIMEZONE | Timezone for cron expressions |
| Key | Type | Default | Env Var | Description |
|---|
enabled | bool | False | LEX_TASKS__RATE_LIMIT__ENABLED | Enable rate limiting |
rate | int | 100 | LEX_TASKS__RATE_LIMIT__RATE | Tasks allowed per time period |
per | float | 1.0 | LEX_TASKS__RATE_LIMIT__PER | Time period (seconds) |
burst | int | None | None | LEX_TASKS__RATE_LIMIT__BURST | Max burst size |
| Key | Type | Default | Env Var | Description |
|---|
default_timeout | float | 300.0 | LEX_TASKS__TIMEOUT__DEFAULT_TIMEOUT | Default task timeout |
max_timeout | float | 3600.0 | LEX_TASKS__TIMEOUT__MAX_TIMEOUT | Maximum allowed timeout |
enforce_timeout | bool | True | LEX_TASKS__TIMEOUT__ENFORCE_TIMEOUT | Enforce timeouts |
Used in TaskConfig.backends for multi-backend queues.
| Key | Type | Default | Description |
|---|
name | str | (required) | Unique backend name for Named() DI resolution |
primary | bool | False | Also register under unnamed TaskQueueProtocol |
type | str | "memory" | Backend type: memory, redis, rabbitmq, postgres |
redis_url | SecretStr | None | None | Redis URL (when type: redis) |
amqp_url | SecretStr | None | None | AMQP URL (when type: rabbitmq) |
postgres_dsn | SecretStr | None | None | Postgres DSN (when type: postgres) |
queue_name | str | "tasks" | Queue name for this backend |
Nested keys use __ as delimiter:
export LEX_TASKS__BACKEND__REDIS_URL="redis://prod-cluster:6379"
export LEX_TASKS__WORKER__WORKER_COUNT=16
export LEX_TASKS__SCHEDULER__ENABLED=false
# Set production environment
export LEX_TASKS__ENV=production