No project description provided
Project description
gke-taskflow
Adds support for Taskflow to the GKEStartPodOperator in Airflow.
This allows us to write cleaner, more pythonic DAGs.
Installation
This backage will need to be installed into the same environment as Airflow in order to function correctly. For Cloud Composer, we'll have to follow the docs.
PIP
Execute the following:
pip install gke-taskflow
Use
After the package is installed, you can define your task using the
@task.gke_pod
decorator:
from datetime import datetime
from airflow.decorators import dag, task
@dag(
schedule=None,
start_date=datetime(2023, 7, 15),
tags=["testing"]
)
def example_dag_taskflow():
@task.gke_pod(
image="python:3.10-slim",
task_id="test_flow",
name="test_flow",
cluster_name="test-cluster",
namespace="composer-internal",
location="us-central1",
project_id="test-cluster-123abc",
)
def hello_world_from_container():
print("hello world from container")
hello_world_from_container()
example_dag_taskflow()
The keyword arguments supplied to @task.gke_pod
are identical to those
supplied to Google's GKEStartPodOperator, on which this work is based.
The docs for that class
are scant, but the source code is available
online for review.
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
File details
Details for the file gke-taskflow-1.0.0.tar.gz
.
File metadata
- Download URL: gke-taskflow-1.0.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78b6c3328cd1af4f1146f0e4d2d457573c19ce47610ef061ad243b18e190b321 |
|
MD5 | e5dba005191db776a4d97d7707d7353a |
|
BLAKE2b-256 | 331b08406dba55fdb22b0e7312263c8681e05ef1cfd7dbe44f1286bba4dbf11a |