> ## Documentation Index
> Fetch the complete documentation index at: /docs/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>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker\_channel.py#L119](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L119)</sup>

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

### `close_worker_channel` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker\_channel.py#L724](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L724)</sup>

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

### `build_worker_channel_work_pool_snapshot` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker\_channel.py#L731](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L731)</sup>

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

### `publish_snapshot_invalidation` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker\_channel.py#L824](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L824)</sup>

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

### `parse_snapshot_invalidation` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker\_channel.py#L839](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L839)</sup>

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

## Classes

### `WorkerChannelSnapshotInvalidation` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker\_channel.py#L110](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L110)</sup>

**Methods:**

#### `model_validate_list` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L56](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L56)</sup>

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

#### `reset_fields` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L85](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L85)</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>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker\_channel.py#L115](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L115)</sup>

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

### `WorkerChannelConnection` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker\_channel.py#L123](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L123)</sup>

**Methods:**

#### `cleanup_enabled` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker\_channel.py#L163](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L163)</sup>

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

#### `close` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker\_channel.py#L239](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L239)</sup>

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

#### `dispatch_one_cleanup_message` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker\_channel.py#L297](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L297)</sup>

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

#### `has_cleanup_capacity` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker\_channel.py#L285](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L285)</sup>

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

#### `queue_snapshot` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker\_channel.py#L256](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L256)</sup>

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

#### `run` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker\_channel.py#L170](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/worker_channel.py#L170)</sup>

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