Celery.Canvas (celery v0.1.0)

Copy Markdown View Source

Celery Canvas workflow primitives (signature, chain, group, chord) compatible with Python Celery's wire protocol.

Summary

Functions

Executes a sequential chain of %Celery.Canvas.Signature{} tasks.

Dispatches a chord (a parallel header of %Celery.Canvas.Signature{} tasks followed by a body callback %Celery.Canvas.Signature{} that receives the list of header results). Returns {:ok, callback_result}.

Dispatches a parallel group of %Celery.Canvas.Signature{} tasks and returns {:ok, %Celery.Result.GroupResult{}}.

Creates a %Celery.Canvas.Signature{} (s/2).

Creates an immutable %Celery.Canvas.Signature{} (si/2).

Functions

chain(sigs, opts)

@spec chain([Celery.Canvas.Signature.t()], keyword()) ::
  {:ok, Celery.Result.t()} | {:error, term()}

Executes a sequential chain of %Celery.Canvas.Signature{} tasks.

In Celery Protocol v2, the first task in the chain is published with the remaining tasks stored in its chain embed list (in reverse order, as Python Celery pops from the end of request.chain!). Returns {:ok, last_task_result} with parent links pointing up the chain.

chord(header_sigs, body_sig, opts \\ [])

@spec chord([Celery.Canvas.Signature.t()], Celery.Canvas.Signature.t(), keyword()) ::
  {:ok, Celery.Result.t()} | {:error, term()}

Dispatches a chord (a parallel header of %Celery.Canvas.Signature{} tasks followed by a body callback %Celery.Canvas.Signature{} that receives the list of header results). Returns {:ok, callback_result}.

group(sigs, opts \\ [])

@spec group([Celery.Canvas.Signature.t()], keyword()) ::
  {:ok, Celery.Result.GroupResult.t()} | {:error, term()}

Dispatches a parallel group of %Celery.Canvas.Signature{} tasks and returns {:ok, %Celery.Result.GroupResult{}}.

s(task_or_sig, opts \\ [])

Creates a %Celery.Canvas.Signature{} (s/2).

si(task_name, opts \\ [])

Creates an immutable %Celery.Canvas.Signature{} (si/2).

signature(task_or_sig, opts \\ [])