Apache Airflow operator for running Google Cloud Run Jobs using green energy
Project description
📖 About
VertFlow is an Airflow operator for
running Cloud Run Jobs on Google Cloud Platform in green data
centres.
Cloud Run is a serverless container runtime, meaning you BYO Docker image and emit carbon only when the job is running.
This is easier, cheaper and greener than managing a Kubernetes cluster spinning 24/7.
Not all data centres are created equal.
Data centres run on electricity generated from various sources, including fossil fuels which emit harmful carbon
emissions. Some data centres are greener than others, using electricity from renewable sources such as wind and hydro.
When you deploy a container on Airflow using the VertFlow operator, it will run your container in the greenest GCP data
centre possible.
ℹ️ Use VertFlow on Cloud Composer 2 to save even more money and CO2.
🔧 How to install
pip install VertFlow
on your Airflow instance.- Ensure your Airflow scheduler has outbound access to the public internet and the
roles/run.developer
Cloud IAM role. - Get an API Key for CO2 Signal, free for non-commercial use. Store in an Airflow variable called
VERTFLOW_API_KEY
.
ℹ️ If you're using Cloud Composer, these instructions may be helpful:
🖱 How to use
Use the VertFlowOperator
to instantiate a task in your DAG.
Provide:
- The address of the Docker image to run.
- A runtime specification, e.g. timeout and memory limits.
- A set of allowed regions to run the job in, based on your latency, data governance and other considerations. VertFlow picks the greenest one.
from VertFlow.operator import VertFlowOperator
from airflow import DAG
with DAG(
dag_id="hourly_dag_in_green_region",
schedule_interval="@hourly"
) as dag:
task = VertFlowOperator(
image_address="us-docker.pkg.dev/cloudrun/container/job:latest",
name="hello-world",
allowed_regions=["europe-west1", "europe-west4"],
command="echo",
arguments=["Hello World"],
service_account_email_address="my-service-account@embroidered-elephant-739.iam.gserviceaccount.com",
...
)
🔌🗺 Shout out to CO2 Signal
VertFlow works thanks to real-time global carbon intensity data, gifted to the world for non-commercial use by CO2 Signal.
🤝 How to contribute
Found a bug or fancy resolving an issue? We welcome Pull Requests!
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
Built Distribution
File details
Details for the file VertFlow-0.4.0.tar.gz
.
File metadata
- Download URL: VertFlow-0.4.0.tar.gz
- Upload date:
- Size: 20.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e3371fa65b737fb4a81db5443a7a4f10578b5df13767601cb07f929ea14ac00 |
|
MD5 | 95482c6ade0cde093c6efa7dfab5b465 |
|
BLAKE2b-256 | a14cc44bb016457543744b2bea3ad4212c3ccf3a9789569a8920291bdef177bf |
File details
Details for the file VertFlow-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: VertFlow-0.4.0-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1001716675f2ae813eaa92f63951c25f7c9ea32a2c0cf3fb51b18a1518d3fc9e |
|
MD5 | 072dd9660bfecf246d5e9871636091be |
|
BLAKE2b-256 | d288dd1f261d020a635cd4e82cfc116295c4a1b3da7dd1e5bd0c384ff31bf5ba |