Skip to main content

Flink SQL Gateway Python Client

A client library for accessing Flink Job Manager REST API (mostly generated by OpenAPI Generator)

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:

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
# code gen
make gen
make release

# release production
make release_production
  1. Manual release
# 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"

Metadata

Release files for flink-job-manager-api 1.0.2

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

Source distribution (sdist)

Source distribution for flink-job-manager-api 1.0.2
File Size Uploaded
flink_job_manager_api-1.0.2.tar.gz 61.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flink-job-manager-api 1.0.2
File Interpreter ABI Platform
flink_job_manager_api-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 277.3 kB

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