Celery.Config (celery v0.1.0)

Copy Markdown View Source

Celery configuration structure and defaults (ported from celery.app.defaults).

Supports only Redis for broker transport and result backend (plus memory:// via Kombu and FakeRedis for local unit testing).

Summary

Functions

Builds a normalized %Celery.Config{} from keyword options or a map.

Updates an existing %Celery.Config{} with new settings.

Validates that the broker URL uses Redis (or memory:// for testing). Raises ArgumentError for unsupported transports.

Validates that the result backend URL uses Redis (or nil when disabled). Raises ArgumentError for unsupported backends.

Types

t()

@type t() :: %Celery.Config{
  accept_content: [String.t()],
  broker_transport_options: keyword() | map(),
  broker_url: String.t(),
  enable_utc: boolean(),
  include: [module() | String.t()],
  main: String.t(),
  redis_conn: GenServer.server() | nil,
  result_backend: String.t() | nil,
  result_backend_transport_options: keyword() | map(),
  result_chord_join_timeout: number(),
  result_chord_ordered: boolean(),
  result_compression: String.t() | nil,
  result_expires: non_neg_integer() | nil,
  result_extended: boolean(),
  result_serializer: String.t(),
  task_ack_on_failure_or_timeout: boolean(),
  task_acks_late: boolean(),
  task_always_eager: boolean(),
  task_compression: String.t() | nil,
  task_default_delivery_mode: 1 | 2,
  task_default_exchange: String.t(),
  task_default_exchange_type: String.t(),
  task_default_queue: String.t(),
  task_default_routing_key: String.t(),
  task_eager_propagates: boolean(),
  task_ignore_result: boolean(),
  task_protocol: 1 | 2,
  task_publish_retry: boolean(),
  task_queues: [Kombu.Queue.t()] | nil,
  task_reject_on_worker_lost: boolean(),
  task_routes: map() | keyword(),
  task_serializer: String.t(),
  task_soft_time_limit: number() | nil,
  task_store_eager_result: boolean(),
  task_store_errors_even_if_ignored: boolean(),
  task_time_limit: number() | nil,
  task_track_started: boolean(),
  timezone: String.t(),
  worker_concurrency: pos_integer(),
  worker_enable_remote_control: boolean(),
  worker_prefetch_multiplier: pos_integer()
}

Functions

new(opts \\ [])

@spec new(keyword() | map()) :: t()

Builds a normalized %Celery.Config{} from keyword options or a map.

Accepts both Python-style shorthand keys (:broker, :backend, :changes) and canonical Celery configuration keys (:broker_url, :result_backend).

update(config, changes)

@spec update(t(), keyword() | map()) :: t()

Updates an existing %Celery.Config{} with new settings.

validate_broker_url!(url)

@spec validate_broker_url!(String.t() | nil) :: :ok

Validates that the broker URL uses Redis (or memory:// for testing). Raises ArgumentError for unsupported transports.

validate_result_backend!(url)

@spec validate_result_backend!(String.t() | nil) :: :ok

Validates that the result backend URL uses Redis (or nil when disabled). Raises ArgumentError for unsupported backends.