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

# worker_channel

# `prefect.server.utilities.worker_channel`

## Functions

### `work_pool_update_triggers_snapshot` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L78" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
work_pool_update_triggers_snapshot(update_values: Mapping[str, Any]) -> bool
```

### `close_worker_channel` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L568" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
close_worker_channel(websocket: WebSocket, close_reason: WorkerChannelCloseReason) -> None
```

### `build_worker_channel_work_pool_snapshot` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L575" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
build_worker_channel_work_pool_snapshot(session: AsyncSession, work_pool: ORMWorkPool) -> WorkPoolSnapshot
```

### `publish_snapshot_invalidation` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L666" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
publish_snapshot_invalidation(invalidation: WorkerChannelSnapshotInvalidation) -> None
```

### `parse_snapshot_invalidation` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L681" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
parse_snapshot_invalidation(message: messaging.Message) -> WorkerChannelSnapshotInvalidation
```

## Classes

### `WorkerChannelSnapshotInvalidation` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L69" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

**Methods:**

#### `model_validate_list` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L56" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
model_validate_list(cls, obj: Any) -> list[Self]
```

#### `reset_fields` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L85" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
reset_fields(self: Self) -> Self
```

Reset the fields of the model that are in the `_reset_fields` set.

**Returns:**

* A new instance of the model with the reset fields.

#### `targets` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L74" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
targets(self) -> bool
```

### `WorkerChannelConnection` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L82" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

**Methods:**

#### `cleanup_enabled` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L120" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
cleanup_enabled(self) -> bool
```

#### `close` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L177" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
close(self, close_reason: WorkerChannelCloseReason) -> None
```

#### `dispatch_one_cleanup_message` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L216" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
dispatch_one_cleanup_message(self) -> bool
```

#### `has_cleanup_capacity` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L204" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
has_cleanup_capacity(self) -> bool
```

#### `queue_snapshot` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L185" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
queue_snapshot(self, invalidation: WorkerChannelSnapshotInvalidation) -> None
```

#### `run` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L127" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
run(self, ready: WorkerReadyFrame, consumer_kwargs: Mapping[str, Any]) -> None
```
