IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python class

Checkpointer

Checkpointer​

class max.pipelines.kv_cache.checkpoint.Checkpointer(ctx)

source

Bases: object

Collects lifecycle events and runs heuristics.

Initializes the checkpointer.

Parameters:

ctx (Context) – The context the heuristics read.

checkpoint()​

checkpoint()

source

Runs each callback the step’s events triggered, once.

Returns:

The distinct checkpoints chosen.

Return type:

set[Checkpoint]

factory()​

static factory()

source

Returns a factory to configure and build a checkpointer.

Return type:

CheckpointerFactory

handles()​

handles(kind)

source

Returns whether any heuristic runs on events of kind.

Parameters:

kind (EventKind)

Return type:

bool

record()​

record(event)

source

Records an event for the next checkpoint step.

Call it before the request’s cache can change, for example before releasing it. Events no heuristic handles are dropped.

Parameters:

event (Event)

Return type:

None

register()​

register(*heuristics)

source

Subscribes each of heuristics and returns this checkpointer.

Parameters:

heuristics (Heuristic)

Return type:

Self