Skip to main content

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.spark.spark_job import Flow, Priority

HOST = "<DATAPLANE_HOST>" # https://dataplane-endpoint.example.com
API_KEY = "<IOMETE_API_KEY>"
DOMAIN = "<IOMETE_DOMAIN>"

job_client = SparkJobApiClient(
    host=HOST,
    api_key=API_KEY,
    domain=DOMAIN
)

Enums

The SDK provides strict enum validation for flow and priority fields:

  • Flow: Flow.LEGACY ("LEGACY"), Flow.PRIORITY ("PRIORITY")
  • Priority: Priority.NORMAL ("NORMAL"), Priority.HIGH ("HIGH")

Create a new job

response = job_client.create_job(payload={
        "name": "job-name",
        "bundleId": "bundle-id",
        "flow": Flow.LEGACY.value,
        "priority": Priority.NORMAL.value,
        "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"]

Note: bundleId is required. flow and priority are optional but validated against enum values if provided.

Get jobs

response = job_client.get_jobs()

Get job by ID

response = job_client.get_job_by_id(job_id=job_id)

Get job by name

response = job_client.get_job_by_name(job_name="job-name")

Update job

response = job_client.update_job(job_id=job_id, payload=updated_payload)

Delete job

response = job_client.delete_job_by_id(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_by_id(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


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-3.1.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iomete_sdk-3.1.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file iomete_sdk-3.1.0.tar.gz.

File metadata

  • Download URL: iomete_sdk-3.1.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for iomete_sdk-3.1.0.tar.gz
Algorithm Hash digest
SHA256 31859d916f0549459725f0bbffae93d7e5d54755a40b62a1f163a6cdf91e738c
MD5 92184388e6a31fb4bb9b635de00e537b
BLAKE2b-256 584122a67a5b20f16c99d719210a18d9a85865e60da2b4f629cc28cbfcf4fc74

See more details on using hashes here.

File details

Details for the file iomete_sdk-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: iomete_sdk-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for iomete_sdk-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 127a74f452cefc32016604c24c85789a45b1a2df61aedb8220f5fb352c4b2267
MD5 66c9a91285c5c2fd21cf44d77067cc2a
BLAKE2b-256 1abb1af7fe8547b846fa5af9e5e63faeea8a0233e1cf399418f5851d02ecbaa4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page