Skip to main content

cohestra-sdk

Python SDK for the Cohestra control plane — deploy, scale, rollback, and observe Apache Flink jobs on any Kubernetes cluster.

Install

pip install cohestra-sdk
# with Lambda extras:
pip install cohestra-sdk[lambda]

Quick start

from cohestra_sdk import CohestraClient, DeploymentSpec, ResourceShape

client = CohestraClient("https://cohestra.yourcluster.internal:8080", token="...")

# Register a deployment
client.register("prod", "streaming", "orders", owner="platform-team")

# Get a deployment handle
orders = client.deployment("prod", "streaming", "orders")

# Deploy a new version
orders.deploy(
    DeploymentSpec(
        image_digest="registry.example/orders@sha256:abc123",
        parallelism=8,
        max_parallelism=128,
        resources=ResourceShape(task_manager_cpu=2, task_manager_memory_mib=4096,
                                task_manager_count=2, slots_per_manager=4),
        flink_config={"state.backend.type": "rocksdb"},
    ),
    requester="ci-pipeline",
    approved=True,
)

# Wait for healthy
orders.wait_healthy(timeout=300)

# Check status
print(orders.status())

Operations

orders.scale(16, approved=True, reason="traffic spike")
orders.savepoint()
orders.suspend(reason="maintenance window")
orders.resume()
orders.rollback(target_version=3, reason="regression in v4")
orders.enable_autoscaler()
orders.freeze_autoscaler()

Custom autoscaler

from cohestra_sdk import CohestraClient, AutoscalerBase, ScaleDecision

class MyAutoscaler(AutoscalerBase):
    def evaluate(self, status):
        lag = status["currentVersion"]["healthSummary"]["kafkaLag"]
        current = status["currentVersion"]["spec"]["parallelism"]
        if lag > 100_000 and current < 32:
            return ScaleDecision(current * 2, reason=f"lag={lag}")
        return None

client = CohestraClient("http://localhost:8080")
scaler = MyAutoscaler(client, "prod", "streaming", "orders")
scaler.run_loop(interval=60)

See examples/kafka_lag_autoscaler.py for an AWS Lambda-ready implementation.

Cluster operations

client.freeze_cluster("prod", "streaming", reason="incident")
client.unfreeze_cluster("prod", "streaming")

Metadata

Release files for cohestra-sdk 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cohestra-sdk 0.1.1
File Size Uploaded
cohestra_sdk-0.1.1.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cohestra-sdk 0.1.1
File Interpreter ABI Platform
cohestra_sdk-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.6 kB

Release files / cohestra_sdk-0.1.1.tar.gz

Download URL cohestra_sdk-0.1.1.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8921259fb1cb2e2a7c5ac6c02c5b11cde54d772512c16bbb8aea35f008a91b73
BLAKE2b-256 checksum
How to use checksums
ad6231da0dcd9e5afb9069cb04d7484f2bae4f45aa2dc029bb4e4455cfdf3854
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 29, 2026.

Transparency log

Release files / cohestra_sdk-0.1.1-py3-none-any.whl

Download URL cohestra_sdk-0.1.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f2be6a8dc6670e746f0a72c773c061abba7e35a6df4f9dda570c9402b3e9a857
BLAKE2b-256 checksum
How to use checksums
8c592530923afb04fe0bf8feb770dbf6e3722411ebc49e71242f1650ad2adfd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page