Hera is the go-to Python SDK to make Argo Workflows simple and intuitive. Easily turn Python functions into containerised templates that run on Kubernetes, with full access to its capabilities. |
---|
See the Quick Start guide to start using Hera to orchestrate your Argo Workflows!
The Argo was constructed by the shipwright Argus,
and its crew were specially protected by the goddess Hera.
from hera.workflows import DAG, Workflow, script
# Turn a function into a reusable "Script template"
# using the script decorator
@script()
def echo(message: str):
print(message)
# Orchestration logic lives *outside* of business logic
with Workflow(
generate_name="dag-diamond-",
entrypoint="diamond",
) as w:
with DAG(name="diamond"):
A = echo(name="A", arguments={"message": "A"})
B = echo(name="B", arguments={"message": "B"})
C = echo(name="C", arguments={"message": "C"})
D = echo(name="D", arguments={"message": "D"})
A >> [B, C] >> D # Define execution order
# Create the workflow directly on your Argo Workflows cluster!
w.create()
Check out the examples to see how to construct and submit Argo Workflows with Hera!
Hera requires an Argo Workflows server to be deployed to a Kubernetes cluster. To learn how to deploy Argo to your own Kubernetes cluster you can follow the Argo Workflows guide!
Hera assumes that the Argo server sits behind an authentication layer, so workflow submission requests are authenticated
using a Bearer token on the request. Another option for workflow submission without the authentication layer is using
port forwarding to your Argo server deployment and submitting workflows to localhost:2746
.
There are a few ways to authenticate in Hera - read more in the
authentication walkthrough - for now, with the
argo
cli tool installed, and the server port-forwarded to localhost:2746
, this example will get you up and running:
from hera.workflows import Workflow, Container
from hera.shared import global_config
from hera.auth import ArgoCLITokenGenerator
global_config.host = "http://localhost:2746"
global_config.token = ArgoCLITokenGenerator
with Workflow(generate_name="local-test-", entrypoint="c") as w:
Container(name="c", image="docker/whalesay", command=["cowsay", "hello"])
w.create()
Source | Command |
---|---|
PyPI | pip install hera |
GitHub repo | python -m pip install git+https://github.com/argoproj-labs/hera --ignore-installed |
- Install via
hera[yaml]
- PyYAML is required for the
yaml
output format, which is accessible viahera.workflows.Workflow.to_yaml(*args, **kwargs)
. This enables GitOps practices and easier debugging.
- Install via
hera[cli]
. The[cli]
option installs the extra dependency Cappa required for the CLI - The CLI aims to enable GitOps practices, easier debugging, and a more seamless experience with Argo Workflows.
- The CLI is an experimental feature and subject to change! At the moment it only supports generating YAML files
from workflows via
hera generate yaml
. Seehera generate yaml --help
for more information.
- Install via
hera[experimental]
. The[experimental]
option adds dependencies required for experimental features that have not yet graduated into stable features.
- KubeCon/ArgoCon NA 2024 - Data Science Workflows Made Easy: Python-Powered Argo for Your Organization
- KubeCon/ArgoCon EU 2024 - Orchestrating Python Functions Natively in Argo Using Hera
- CNCF TAG App-Delivery @ KubeCon NA 2023 - Automating the Deployment of Data Workloads to Kubernetes with ArgoCD, Argo Workflows, and Hera
More presentations
- KubeCon/ArgoCon NA 2023 - How to Train an LLM with Argo Workflows and Hera
- KubeCon/ArgoCon EU 2023 - Scaling gene therapy with Argo Workflows and Hera
- DoKC Town Hall #2 - Unsticking ourselves from Glue - Migrating PayIt's Data Pipelines to Argo Workflows and Hera
- Argo Workflows and Events Community Meeting 15 June 2022 - Hera project update
- Argo Workflows and Events Community Meeting 20 Oct 2021 - Hera introductory presentation
- How To Get the Most out of Hera for Data Science
- Data Validation with Great Expectations and Argo Workflows
- Hera introduction and motivation
- Dyno is scaling gene therapy research with cloud-native tools like Argo Workflows and Hera
Use one of the following to open the repo in a cloud dev box:
Read more in the contributing guide!
These emeritus maintainers dedicated a part of their career to Hera and reviewed code, triaged bugs and pushed the project forward over a substantial period of time. Their contribution is greatly appreciated:
Hera is licensed under Apache 2.0. See License for details.