> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# task_queue

# `prefect.server.task_queue`

Implements an in-memory task queue for delivering background task runs to TaskWorkers.

## Classes

### `TaskQueue` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task\_queue.py#L17](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task_queue.py#L17)</sup>

**Methods:**

#### `configure_task_key` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task\_queue.py#L36](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task_queue.py#L36)</sup>

```python theme={null}
configure_task_key(cls, task_key: str, scheduled_size: Optional[int] = None, retry_size: Optional[int] = None) -> None
```

#### `enqueue` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task\_queue.py#L32](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task_queue.py#L32)</sup>

```python theme={null}
enqueue(cls, task_run: schemas.core.TaskRun) -> None
```

#### `for_key` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task\_queue.py#L47](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task_queue.py#L47)</sup>

```python theme={null}
for_key(cls, task_key: str) -> Self
```

#### `get` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task\_queue.py#L66](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task_queue.py#L66)</sup>

```python theme={null}
get(self) -> schemas.core.TaskRun
```

#### `get_nowait` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task\_queue.py#L73](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task_queue.py#L73)</sup>

```python theme={null}
get_nowait(self) -> schemas.core.TaskRun
```

#### `put` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task\_queue.py#L80](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task_queue.py#L80)</sup>

```python theme={null}
put(self, task_run: schemas.core.TaskRun) -> None
```

#### `reset` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task\_queue.py#L56](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task_queue.py#L56)</sup>

```python theme={null}
reset(cls) -> None
```

A unit testing utility to reset the state of the task queues subsystem

#### `retry` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task\_queue.py#L83](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task_queue.py#L83)</sup>

```python theme={null}
retry(self, task_run: schemas.core.TaskRun) -> None
```

### `MultiQueue` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task\_queue.py#L87](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task_queue.py#L87)</sup>

A queue that can pull tasks from from any of a number of task queues

**Methods:**

#### `get` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task\_queue.py#L95](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/task_queue.py#L95)</sup>

```python theme={null}
get(self) -> schemas.core.TaskRun
```

Gets the next task\_run from any of the given queues
