IOMETE SDK for Python.
Project description
IOMETE SDK
This is the IOMETE SDK for Python. It provides convenient access to the IOMETE API from applications written in the Python language.
Installation
Install the package with:
pip install iomete-sdk
Usage - Spark Job API
Import and initialize the client
from iomete_sdk.spark import SparkJobApiClient
from iomete_sdk.api_utils import ClientError
HOST = "<YOUR_DATAPLANE_HOST>" # https://dataplane-endpoint.example.com
API_KEY = "<YOU_IOMETE_API_KEY>"
job_client = SparkJobApiClient(
host=HOST,
api_key=API_KEY,
)
Create a new job
response = job_client.create_job(payload={
"name": "job-name",
"namespace": "k8s-namespace",
"jobUser": "job-user",
"jobType": "MANUAL/SCHEDULED/STREAMING",
"template": {
"applicationType": "python",
"image": f"iomete/spark-py:3.5.3-v1",
"mainApplicationFile": "path/to/job.py",
"configMaps": [{
"key": "application.conf",
"content": "[SELECT 1]",
"mountPath": "/etc/configs"
}],
"deps": {
"pyFiles": ["path/to/dependencies.zip"]
},
"instanceConfig": {
"singleNodeDeployment": False, "driverType": "driver-x-small",
"executorType": "exec-x-small", "executorCount": 1
},
"restartPolicy": {"type": "Never"},
"maxExecutionDurationSeconds": "max-execution-duration",
"volumeId": "volume-id",
}
})
job_id = response["id"]
Get jobs
response = job_client.get_jobs()
Get job
response = job_client.get_job(job_id=job_id)
Update job
response = job_client.update_job(job_id=job_id, payload=updated_payload)
Delete job
response = job_client.delete_job(job_id=job_id)
Submit job run
response = job_client.submit_job_run(job_id=job_id, payload={})
Cancel job run
response = job_client.cancel_job_run(job_id=job_id, run_id=run_id)
Get Job Runs
response = job_client.get_job_runs(job_id=job_id)
Get Job Run
response = job_client.get_job_run(job_id=job_id, run_id=run_id)
Get Job Run Logs
response = job_client.get_job_run_logs(job_id=job_id, run_id=run_id, time_range="5m")
Supported Time Range: 5m, 15m, 30m, 1h, 3h, 6h, 12h, 24h, 2d, 7d, 14d, 30d
Get Job Run Metrics
response = job_client.get_job_run_metrics(job_id=job_id, run_id=run_id)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
iomete_sdk-2.1.2.tar.gz
(9.0 kB
view details)
File details
Details for the file iomete_sdk-2.1.2.tar.gz.
File metadata
- Download URL: iomete_sdk-2.1.2.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9880d701cdcd58537b5b224054c721c55049e19cff08fe2a4cc5b2fd2e2d4bca
|
|
| MD5 |
8e12ea566c61b79f33195f2f300c7109
|
|
| BLAKE2b-256 |
60128e2d4559953c0173191aa475a062c81e48e5a0b51079b156852966d3177e
|