SDK for building and deploying data pipelines on SentientX Data Platform
Project description
SXD SDK
Python library for building data pipelines on SentientX Data Platform.
Installation
pip install sxd-sdk
Quick Start
1. Create Pipeline
Create a new directory with this structure:
my-pipeline/
├── my_pipeline/
│ ├── __init__.py
│ └── activities.py
├── sxd.yaml
└── pyproject.toml
2. Define Tasks
# my_pipeline/activities.py
from sxd_sdk import sxd_task, TaskContext, ProcessingResult
@sxd_task(name="process_video")
async def process_video(input_data: dict, ctx: TaskContext) -> dict:
video_path = input_data["source_url"]
await ctx.heartbeat(f"Processing {video_path}")
result = ProcessingResult.ok(output_path="/output/result.mp4")
return result.model_dump()
3. Configure (sxd.yaml)
base_image: sxd-base # or: sxd-pytorch, sxd-opencv, sxd-cuda
timeout: 3600 # optional, default 3600s
gpu: false # optional, default false
4. Publish
sxd publish .
5. Submit Tasks
sxd submit process_video --input '{"source_url": "s3://bucket/video.mp4"}'
API Reference
Schemas
from sxd_sdk import (
PipelineInput, # Base input with source_url, customer_id, options
PipelineOutput, # Base output with status, output_path, metrics, errors
ProcessingResult, # Task result with success, output_path, error, metadata
)
# Convenience constructors
result = ProcessingResult.ok("/output/path", count=10)
result = ProcessingResult.fail("Something went wrong")
Testing
from sxd_sdk.testing import MockTaskContext, MockControlPlane
# Test tasks
async def test_my_task():
ctx = MockTaskContext()
result = await process_video({"source_url": "s3://video.mp4"}, ctx)
assert result["success"]
assert ctx._heartbeats # verify heartbeat was called
Client
from sxd_sdk import SXDClient
client = SXDClient(api_url="https://api.example.com", api_key="...")
task = await client.submit("process_video", {"source_url": "s3://video.mp4"})
status = await client.status(task["id"])
License
Apache 2.0
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
sxd_sdk-0.3.0.tar.gz
(47.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
sxd_sdk-0.3.0-py3-none-any.whl
(47.2 kB
view details)
File details
Details for the file sxd_sdk-0.3.0.tar.gz.
File metadata
- Download URL: sxd_sdk-0.3.0.tar.gz
- Upload date:
- Size: 47.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b572936db35ecad95437740ee231a6ffab8e6edd8bfa64a99b04cd7f42e72108
|
|
| MD5 |
1176ab4758077453ec4c390445b15bae
|
|
| BLAKE2b-256 |
565fdbe76497e64f8082b2e49c43130b5bc578bf1ed6cc267a70679045634517
|
File details
Details for the file sxd_sdk-0.3.0-py3-none-any.whl.
File metadata
- Download URL: sxd_sdk-0.3.0-py3-none-any.whl
- Upload date:
- Size: 47.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9642c73a415a327883f022b9c6478b65e6e298d68b70acc756fbb1fc591e34d
|
|
| MD5 |
e88371cbfc7d47b9b2c82356c6ff4ac0
|
|
| BLAKE2b-256 |
cc0a77e7305c3f99933d7b9bad30909350baec7ebc0e1f153d94d31e58ad8cd4
|