Skip to content

Environment variables

Several init() arguments can be supplied via environment variables instead. An explicit argument to init() always takes precedence over the corresponding variable.

Variable Equivalent init() argument
METRANA_API_KEY api_key
METRANA_ORCHESTRATION_ID orchestration_id
METRANA_BACKPRESSURE_STRATEGY backpressure_strategy
METRANA_DELIVERY_POLICY delivery_policy
METRANA_RENDERING_ERROR_STRATEGY rendering_error_strategy
METRANA_RESUME_STRATEGY resume_strategy
METRANA_LOG_LEVEL log_level
METRANA_EVENT_QUEUE_MAX_SIZE queue_capacity
METRANA_SKIP_DRAIN_RENDER_ON_CLOSE skip_drain_render_on_close
METRANA_RENDERING_CLOSE_TIMEOUT rendering_close_timeout
  • METRANA_API_KEY is the most common one — set it in your environment so you never hard-code a key:
    Terminal window
    export METRANA_API_KEY="your-api-key"
    It’s also the fallback used by replay_spool.
  • METRANA_ORCHESTRATION_ID is auto-populated by the SDK after resolution, so forked/spawned children inherit the same run. See Distributed logging.
  • Framework job ids (TORCHELASTIC_RUN_ID, SLURM_JOB_ID, RAY_JOB_ID) are read automatically to resolve the orchestration id when METRANA_ORCHESTRATION_ID is unset — you don’t set these yourself.