# `Celery.Result`
[🔗](https://github.com/hacktobeer/celery-elixir/blob/v0.1.0/lib/celery/result.ex#L1)

Task result handle (`AsyncResult` in Python Celery, ported from `celery.result.AsyncResult`).

Provides querying of task state, result value, traceback, and blocking `get/2`
backed by `Celery.Backend.Redis`, as well as local eager execution results.

# `t`

```elixir
@type t() :: %Celery.Result{
  app: Celery.t() | Celery.Config.t() | nil,
  eager_result: term(),
  eager_state: String.t() | nil,
  eager_traceback: String.t() | nil,
  id: String.t(),
  is_eager: boolean(),
  parent: t() | nil
}
```

# `backend_meta`

```elixir
@spec backend_meta(t()) :: map()
```

Returns the full task metadata map from Redis.

# `eager`

```elixir
@spec eager(String.t(), term(), String.t(), keyword()) :: t()
```

Creates an eager `%Celery.Result{}` (`EagerResult` in Python Celery).

# `failed?`

```elixir
@spec failed?(t()) :: boolean()
```

Returns `true` if the task failed (`state == "FAILURE"`).

# `forget`

```elixir
@spec forget(t()) :: :ok
```

Forgets (deletes) the result from the Redis result backend.

# `get`

```elixir
@spec get(t(), keyword()) :: term()
```

Waits until the task is ready and returns its result.

Options:
- `:timeout` - timeout in milliseconds, float seconds, or `:infinity` (default `:infinity`)
- `:interval` - poll interval in milliseconds (default `50`)
- `:propagate` - re-raise exception if the task failed or was revoked (default `true`)

# `info`

```elixir
@spec info(t()) :: term()
```

Alias for `result/1` (matches `AsyncResult.info` in Python Celery).

# `new`

```elixir
@spec new(String.t(), keyword()) :: t()
```

Creates a new `%Celery.Result{}` (`AsyncResult`) for `task_id`.

# `ready?`

```elixir
@spec ready?(t()) :: boolean()
```

Returns `true` if the task has been executed (`SUCCESS`, `FAILURE`, or `REVOKED`).

# `result`

```elixir
@spec result(t()) :: term()
```

Returns the task's stored result (or exception struct if failed, or `nil` if pending).

# `revoke`

```elixir
@spec revoke(t(), keyword()) :: :ok
```

Revokes the task by marking it revoked in the backend and optionally broadcasting a
revoke control command over `Kombu.Pidbox`.

# `state`

```elixir
@spec state(t()) :: String.t()
```

Returns the task's current state (`"PENDING"`, `"STARTED"`, `"SUCCESS"`, `"FAILURE"`, `"REVOKED"`, `"RETRY"`).

# `status`

```elixir
@spec status(t()) :: String.t()
```

Alias for `state/1` (matches `AsyncResult.status` in Python Celery).

# `successful?`

```elixir
@spec successful?(t()) :: boolean()
```

Returns `true` if the task succeeded (`state == "SUCCESS"`).

# `traceback`

```elixir
@spec traceback(t()) :: String.t() | nil
```

Returns the traceback of a failed task (or `nil`).

---

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