Skip to main content

Pipekit Python SDK

Project description

Pipekit Logo

Pipekit allows you to manage your workflows at scale. The control plane configures Argo Workflows for you in your infrastructure, enabling you to optimize multi-cluster workloads while reducing your cloud spend. The team at Pipekit is also happy to support you through your Argo Workflows journey via commercial support.

Pipekit Python SDK

Installation

pip install pipekit-sdk

Usage

# The Pipekit SDK interacts with Hera Workflows classes
from hera.workflows import Container, Step, Steps, Workflow, script
from pipekit_sdk.service import PipekitService

# Create a Pipekit service that is used to talk to the Pipekit API
pipekit = PipekitService(token="<token>")

# List clusters and Pipes
clusters = pipekit.list_clusters()
pipes = pipekit.list_pipes()

@script()
def flip_coin() -> None:
    import random

    result = "heads" if random.randint(0, 1) == 0 else "tails"
    print(result)

# Create a Workflow using Hera
with Workflow(
    generate_name="coinflip-",
    annotations={
        "workflows.argoproj.io/description": (
            "This is an example of coin flip defined as a sequence of conditional steps."
        ),
    },
    entrypoint="coinflip",
    namespace="argo",
    service_account_name="argo",
) as w:
    heads = Container(
        name="heads",
        image="alpine:3.6",
        command=["sh", "-c"],
        args=['echo "it was heads"'],
    )
    tails = Container(
        name="tails",
        image="alpine:3.6",
        command=["sh", "-c"],
        args=['echo "it was tails"'],
    )

    with Steps(name="coinflip") as s:
        fc: Step = flip_coin()

        with s.parallel():
            heads(when=f"{fc.result} == heads")
            tails(when=f"{fc.result} == tails")

# Submit the Workflow to Pipekit
pipekit.submit(w, "<cluster-name>")

# Tail the logs
pipekit.print_logs(pipe_run.uuid)

Further help

Please refer to the Pipekit Documentation for more information.

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

pipekit_sdk-2.1.0.tar.gz (46.8 kB view details)

Uploaded Source

Built Distribution

pipekit_sdk-2.1.0-py3-none-any.whl (49.0 kB view details)

Uploaded Python 3

File details

Details for the file pipekit_sdk-2.1.0.tar.gz.

File metadata

  • Download URL: pipekit_sdk-2.1.0.tar.gz
  • Upload date:
  • Size: 46.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for pipekit_sdk-2.1.0.tar.gz
Algorithm Hash digest
SHA256 dfb4ccc6f011016a080735f9a7e27820bbe29859de2dd97a1606e1e388c0bd6a
MD5 566664cd8e448a5e1426fbd4348669c4
BLAKE2b-256 70bd3c3741977b025475707234a63261fe5c5bc586729bc775bc453e438a080f

See more details on using hashes here.

File details

Details for the file pipekit_sdk-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: pipekit_sdk-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 49.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for pipekit_sdk-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7338917196ed8dabe6cf55aedef0e99352288e273529790ab5951596aca9fc5f
MD5 8739c1b834a4117de6fdeb93278c2a18
BLAKE2b-256 aa5ae72df5892ed126278917b1dbf45f1043cd79d98fa7a693f33b4d31dade86

See more details on using hashes here.

Supported by

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