# `Celery.Canvas`
[🔗](https://github.com/hacktobeer/celery-elixir/blob/v0.1.0/lib/celery/canvas.ex#L187)

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

# `chain`

```elixir
@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`

```elixir
@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`

```elixir
@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`

```elixir
@spec s(String.t() | map() | Celery.Canvas.Signature.t(), keyword()) ::
  Celery.Canvas.Signature.t()
```

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

# `si`

```elixir
@spec si(String.t(), keyword()) :: Celery.Canvas.Signature.t()
```

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

# `signature`

```elixir
@spec signature(String.t() | map() | Celery.Canvas.Signature.t(), keyword()) ::
  Celery.Canvas.Signature.t()
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
