Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Fornax Cutouts User Documentation

Configuration

All configuration is managed via environment variables. Fornax Cutouts uses pydantic-settings with the prefix CUTOUTS__ and __ as the nested delimiter.

Settings can be provided as environment variables or in a .env file in the working directory.


Core Settings

Environment VariableTypeDefaultRequiredDescription
CUTOUTS__SOURCE_PATHpath—YesPath to the directory containing mission source .py files. All .py files under this path are discovered and executed at startup.
CUTOUTS__SERVICE_NAMEstringFornax CutoutsNoDisplay name for the service. When CUTOUTS__WORKER__REDIS_PREFIX is unset, it defaults to this value lowercased with spaces as hyphens (fornax-cutouts).
CUTOUTS__DEPLOYMENT_TYPEstringlocalNoDeployment mode: local or aws.
CUTOUTS__DEPLOYMENT_ENVIRONMENTstringdevNoEnvironment label: sb, dev, test, or prod. Exposed on the health endpoint when not in an ops-only deployment.
CUTOUTS__NUM_TRUSTED_PROXIESint0NoNumber of trusted reverse proxies in front of the API (used for client IP when cutout limiting is enabled). See Auth overview.
CUTOUTS__SYNC_TTLint3600NoExpiration in seconds for presigned S3 URLs (sync API signing and worker signing when enabled). Default is 1 hour.
CUTOUTS__ASYNC_TTLint604800NoTime-to-live in seconds for async job state in Redis, worker presigned URLs for async missions, and the reported UWS destruction time. Default is 1 week.

Logging Settings

Nested under CUTOUTS__LOG__.

Environment VariableTypeDefaultDescription
CUTOUTS__LOG__LEVELstringinfoLog level for the API and worker. Values: critical, error, warning, info, debug.
CUTOUTS__LOG__FORMATstringtextLog format: text (human-readable) or json (structured JSON for log aggregators).
CUTOUTS__LOG__NAMEstringfornax_cutoutsLogger name used by the shared logging setup.

The CLI (fornax-cutouts api / worker) uses CUTOUTS__LOG__LEVEL as the default for --log-level when not passed on the command line.


Redis Settings

Nested under CUTOUTS__REDIS__.

Environment VariableTypeDefaultDescription
CUTOUTS__REDIS__HOSTstringlocalhostRedis server hostname or IP address.
CUTOUTS__REDIS__PORTint6379Redis server port.
CUTOUTS__REDIS__IS_CLUSTERboolfalseSet to true to use the Redis Cluster client instead of the standard client.
CUTOUTS__REDIS__USE_SSLboolfalseEnable TLS for the Redis connection.
CUTOUTS__REDIS__TIMEOUTfloat15.0Connection timeout in seconds.
CUTOUTS__REDIS__SEARCH_ENboolfalseEnable RediSearch index for fast filtered job listing by phase and creation time. Requires the RediSearch module on your Redis instance.

Worker Settings

Nested under CUTOUTS__WORKER__.

Environment VariableTypeDefaultDescription
CUTOUTS__WORKER__REDIS_PREFIXstringfornax-cutoutsPrefix for all Redis keys created by the service. Change this to namespace multiple deployments sharing a Redis instance.
CUTOUTS__WORKER__BATCH_SIZE_PER_WORKERint5Number of cutout tasks dispatched per worker per batch. Tuning this affects memory usage and throughput.
CUTOUTS__WORKER__PREFETCH_MULTIPLIERint1Celery prefetch multiplier. Keep at 1 for memory-intensive workloads.
CUTOUTS__WORKER__MAX_TASKS_PER_CHILDint50Number of tasks a worker process handles before being recycled. Helps prevent memory leaks in long-running workers.
CUTOUTS__WORKER__BATCH_WATCHDOG_TIMEOUT_MINUTESint45Minutes after a batch chord is dispatched before a watchdog task runs to recover stuck or incomplete batches.

Storage Settings

Nested under CUTOUTS__STORAGE__.

Environment VariableTypeDefaultDescription
CUTOUTS__STORAGE__PREFIXstring/tmpRoot path for storing cutout output files. Use a local path for development or an s3://bucket/prefix URI for production.
CUTOUTS__STORAGE__RETURN_SIGNED_URLSboolfalseWhen true and storage is S3-backed, workers replace s3:// result paths with presigned HTTPS URLs before writing job results. Sync endpoints still sign any remaining s3:// paths in the API layer. TTL uses CUTOUTS__SYNC_TTL for sync missions and CUTOUTS__ASYNC_TTL otherwise.

Cutout limit (auth)

Rate limiting for POST /cutouts/async is configured under CUTOUTS__CUTOUT_LIMIT__* and is disabled by default. See Auth overview for ENABLED, ANON_CUTOUT_LIMIT, WINDOW_SECONDS, and PRINCIPAL_RESOLVER.


Deployment Constants

These variables are read directly from the environment (no CUTOUTS__ prefix) and affect runtime behavior.

Environment VariableDefaultDescription
AWS_S3_REGIONus-east-1AWS region used for DuckDB S3 access when querying Parquet files stored in S3.
S3FS_BLOCK_SIZE—Optional. S3 block size in MiB for astrocut file reads. When set, overrides the default fsspec block size via a monkey-patch applied at worker startup. Useful for tuning large FITS file performance.

Example .env File

# Required
CUTOUTS__SOURCE_PATH=/opt/cutouts/sources

# Redis
CUTOUTS__REDIS__HOST=my-redis-cluster.example.com
CUTOUTS__REDIS__PORT=6379
CUTOUTS__REDIS__IS_CLUSTER=true
CUTOUTS__REDIS__USE_SSL=true

# Worker
CUTOUTS__WORKER__BATCH_SIZE_PER_WORKER=10
CUTOUTS__WORKER__MAX_TASKS_PER_CHILD=100

# Storage (S3)
CUTOUTS__STORAGE__PREFIX=s3://my-cutouts-bucket/results

# TTLs
CUTOUTS__SYNC_TTL=3600
CUTOUTS__ASYNC_TTL=604800

# Logging
CUTOUTS__LOG__LEVEL=info
CUTOUTS__LOG__FORMAT=json

# Storage (presign at worker — optional; sync API signs s3:// paths when false)
CUTOUTS__STORAGE__RETURN_SIGNED_URLS=false

# Deployment
CUTOUTS__DEPLOYMENT_TYPE=aws
CUTOUTS__DEPLOYMENT_ENVIRONMENT=prod
AWS_S3_REGION=us-east-1

Configuration Model Reference

The full configuration is defined in fornax_cutouts/config.py. The top-level CONFIG singleton is instantiated at import time and shared across the API and worker processes.