Metadata-Version: 2.3
Name: flink-job-manager-api
Version: 1.0.2a20250423
Summary: A client library for accessing Flink Job Manager REST API
License: Apache-2.0
Keywords: Flink Job Manager,Python,Asyc Client
Author: Shijing Lu
Author-email: shijing.lu@gmail.com
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: attrs (>=21.3.0)
Requires-Dist: httpx (>=0.20.0)
Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
Project-URL: Repository, https://github.com/resink-ai/flink-job-manager-api
Description-Content-Type: text/markdown

# Flink SQL Gateway Python Client

A client library for accessing [Flink Job Manager REST API](https://nightlies.apache.org/flink/flink-docs-master/docs/ops/rest_api/)
(mostly generated by [OpenAPI Generator](https://github.com/openapi-generators))

# Compartibility Overview

| API Versions | Compatible Flink Versions | Comment                                                      |     |
| ------------ | ------------------------- | ------------------------------------------------------------ | --- |
| API V1       | flink-1.16.2 -> flink-2.1 | Allow users to submit statements to the gateway and execute. |     |

## Usage

First, create a client:

```python
from flink_job_manager_api import Client
from flink_job_manager_api.api.default import get_cluster_overview, get_dashboard_configuration
from flink_job_manager_api.models import DashboardConfiguration

BASE_URL = "http://localhost:8081"

# Sync Client:
with Client(BASE_URL) as client:
   response: ClusterOverviewWithVersion = get_cluster_overview.sync(client=client)
   print(f"Flink version: {response.flink_version}")
   print(f"Flink commit: {response.flink_commit}")
   print(f"Jobs cancelled: {response.jobs_cancelled}")
   print(f"Jobs failed: {response.jobs_failed}")
   print(f"Jobs finished: {response.jobs_finished}")
   print(f"Jobs running: {response.jobs_running}")
   print(f"Slots available: {response.slots_available}")
   print(f"Slots free and blocked: {response.slots_free_and_blocked}")
   print(f"Slots total: {response.slots_total}")
   print(f"Taskmanagers: {response.taskmanagers}")
   print(f"Taskmanagers blocked: {response.taskmanagers_blocked}")

# Async Client:
async with Client(BASE_URL) as client:
   response = await get_dashboard_configuration.asyncio(client=client)
```

## Advanced customizations

# Developer

1. Quick start

```bash
# code gen
make gen
make release

# release production
make release_production
```

2. Manual release

```shell
# 1. test, exit if fail
cd $(rev-parse --show-toplevel)/flink-job-manager-api && pytest tests

# 2. check current version
cd $(rev-parse --show-toplevel)
cat flink-job-manager-api/pyproject.toml | grep version
version=$(cat flink-job-manager-api/pyproject.toml| grep version | cut -d '"' -f2)

# 3. tag & release
release_tag='VERSION_TO_BE_SET'
poetry -C flink-job-manager-api/flink-job-manager-api/ version $release_tag
cd $(rev-parse --show-toplevel)
git add -u
git commit -m
git tag -d $release_tag || true
git tag "release-$version"
git push origin "release-$version"
```

