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

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

Drives ONE node: admits requests, runs its phases (continuous-batched across sessions), and delivers results. Keeps the node alive. Usable as a context manager (shutdown on exit).

## `node` (property)

The node this executor drives.

## `__init__`

```python
__init____init__(self, node: clika_runtime._core.runtime.Node, config: clika_runtime._core.runtime.ExecConfig = ExecConfig(max_batch=0, work_budget=0, step_token_budget=0, max_active_sessions=1, max_queued=0, stream=None)) -> None
```

__init__(self, node: clika_runtime._core.runtime.Node, config: clika_runtime._core.runtime.ExecConfig = ExecConfig(max_batch=0, work_budget=0, step_token_budget=0, max_active_sessions=1, max_queued=0, stream=None)) -> None

An executor over `node`, tuned by `config`.

## `cancel`

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

cancel(self, session: int) -> None

Cooperatively cancel an in-flight session; wait() on it then reports the cancellation.

## `create`

```python
createcreate(node: clika_runtime._core.runtime.Node, config: clika_runtime._core.runtime.ExecConfig = ExecConfig(max_batch=0, work_budget=0, step_token_budget=0, max_active_sessions=1, max_queued=0, stream=None)) -> clika_runtime._core.runtime.Executor
```

create(node: clika_runtime._core.runtime.Node, config: clika_runtime._core.runtime.ExecConfig = ExecConfig(max_batch=0, work_budget=0, step_token_budget=0, max_active_sessions=1, max_queued=0, stream=None)) -> clika_runtime._core.runtime.Executor

An executor over `node`, tuned by `config` (the same as Executor(node, config)).

## `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.

## `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).
