---
title: "Pipeline"
sidebar_label: "Pipeline"
description: "The clika_runtime.runtime Pipeline class."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

A serving ensemble; submit with enqueue(), collect with wait(), or stream() a request for per-step chunks. Made by pipeline(). Usable as a context manager (shutdown on exit).

## `__init__`

```python
__init__(self, /, *args, **kwargs)
```

Initialize self.  See help(type(self)) for accurate signature.

## `cancel`

```python
cancelcancel(self, session: int) -> None
```

cancel(self, session: int) -> None

Cooperatively cancel an in-flight session: the step holding it stops at its next step boundary, no later step starts, and wait() or the stream then report the cancellation. A finished session is a no-op; an unknown session raises.

## `enqueue`

```python
enqueueenqueue(self, request: clika_runtime._core.runtime.Request) -> int
```

enqueue(self, request: clika_runtime._core.runtime.Request) -> int

Submit a request; returns the session id. Non-blocking.

## `run`

```python
runrun(self, request: clika_runtime._core.runtime.Request) -> clika_runtime._core.runtime.Response
```

run(self, request: clika_runtime._core.runtime.Request) -> clika_runtime._core.runtime.Response

enqueue() then wait() in one call.

## `shutdown`

```python
shutdownshutdown(self) -> None
```

shutdown(self) -> None

Drain in-flight work and stop; every accepted session completes and wait() still returns its result. A later enqueue() raises.

## `stream`

```python
streamstream(self, request: clika_runtime._core.runtime.Request) -> clika_runtime._core.runtime.ResponseStream
```

stream(self, request: clika_runtime._core.runtime.Request) -> clika_runtime._core.runtime.ResponseStream

Submit a request for streamed retrieval: returns a ResponseStream yielding a ResponseChunk per streamed step (iteration ends with the session; wait() gives the final Response). The request is submitted with streaming=True.

## `wait`

```python
waitwait(self, session: int) -> clika_runtime._core.runtime.Response
```

wait(self, session: int) -> clika_runtime._core.runtime.Response

Block until the session completes; returns its Response (a failed session raises RuntimeError).
