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

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
)

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)

Publishing to PyPI

1. Get PyPI API Token

Before publishing, you need a PyPI API token:

  1. Go to https://pypi.org/ and log in. Username/Password and OTP can be found in 1Password
  2. Navigate to Account Settings → API tokens
  3. Click "Add API token"
  4. Name it (e.g., "iomete-sdk-release")
  5. Scope: Select "Project: iomete-sdk" (or "Entire account" for first release)
  6. Copy the token (starts with pypi-...) - you won't see it again!

2. Configure credentials (optional)

Save token to avoid typing it each time:

# Create/edit ~/.pypirc
cat > ~/.pypirc << EOF
[pypi]
username = __token__
password = pypi-YOUR_TOKEN_HERE
EOF

chmod 600 ~/.pypirc

3. Build and publish

# Clean, build, and check the package
make check

# Upload to PyPI (will prompt for token if not in ~/.pypirc)
make release

When prompted:

  • Username: __token__
  • Password: pypi-YOUR_TOKEN_HERE

4. Verify publication

Check the new version at https://pypi.org/project/iomete-sdk/

Release Checklist

  • Update version in setup.py
  • Update dependencies if needed
  • Run tests: pytest tests/ -v
  • Update CHANGELOG (TODO)
  • Commit changes: git commit -am "Bump version to X.Y.Z"
  • Tag release: git tag vX.Y.Z
  • Push: git push && git push --tags
  • Build and publish: make release

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.0.1.tar.gz (10.5 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.0.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for iomete_sdk-3.0.1.tar.gz
Algorithm Hash digest
SHA256 caf9f093db008836e30d7e340b4e01ddf8a7fbbbdc7ba2594cbbc07092fecd38
MD5 9156dcc793c5eee474759e5130cd1186
BLAKE2b-256 d3639c424dab8fac410078c2a3067d7a757128ba236f1740c42358fadaf65be3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for iomete_sdk-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5cf1b95401ba7a031e6d941b443bd219bffd44031578d272e17d492f651c18d5
MD5 05ec6ced7653907790c266b0e98eab53
BLAKE2b-256 11a7c92f661efcc54d1d859d94df59e233d844e6b4b9844b755b36ff1d7ce24d

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