Pipekit Python SDK
Project description
Pipekit Python SDK
Installation
pip install pipekit-sdk
Usage
from hera.workflows import (
DAG,
Parameter,
Script,
Workflow,
)
from pipekit_sdk.service import PipekitService
# let's create a pipekit service
# that is used to talk to the pipekit api
pipekit = PipekitService(token="<Bearer Token>")
# let's list clusters and pipes
clusters = pipekit.list_clusters()
pipes = pipekit.list_pipes()
# let's create a workflow and submit it to pipekit
# hera's dag-diamond example
def my_print_script(message):
print(message)
def get_script(callable):
# note that we have the _option_ to set `inputs=Parameter(name="message")`, but Hera infers the `Parameter`s
# that are necessary based on the passed in callable!
return Script(
name=callable.__name__.replace("_", "-"),
source=callable,
add_cwd_to_sys_path=False,
image="python:alpine3.6",
)
with Workflow(
generate_name="dag-diamond-",
entrypoint="diamond",
namespace="default",
) as w:
echo = get_script(my_print_script)
with DAG(name="diamond"):
A = echo(name="A", arguments=[Parameter(name="message", value="A")])
B = echo(name="B", arguments=[Parameter(name="message", value="B")])
C = echo(name="C", arguments=[Parameter(name="message", value="C")])
D = echo(name="D", arguments=[Parameter(name="message", value="D")])
A >> [B, C] >> D
# submit the workflow to pipekit
pipe_run = pipekit.submit(w, "<cluster-name>")
# let's tail logs
pipekit.print_logs(pipe_run["uuid"])
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-0.0.1.tar.gz
(4.9 kB
view hashes)
Built Distribution
Close
Hashes for pipekit_sdk-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fdf8f9cc6c4af4b2050383021ce38dbe21eef7f656d9228abc484463ea1ca13 |
|
MD5 | 3a7812101e1c84796f5bd9e97da5b180 |
|
BLAKE2b-256 | 4ddacc9478d09406c88c1eb28e7f2b65d135dae15a9ee18b9e95cf1cdf942781 |