Skip to main content

Apache Airflow operator for running Google Cloud Run Jobs using green energy

Project description

logo
VertFlow

Run Docker containers on Airflow using green energy

Video Demo

📖 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

  1. pip install VertFlow on your Airflow instance.
  2. Ensure your Airflow scheduler has outbound access to the public internet and the roles/run.developer Cloud IAM role.
  3. Get a free API Key for the CO2 Signal API.

ℹ️ 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 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",
        project_id="embroidered-elephant-739",
        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",
        co2_signal_api_key="5bbWXo9PQv3outh45E4fsLHwgsXvf1Z"
        ...
    )

🔌🗺 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

VertFlow-0.1.4a1.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

VertFlow-0.1.4a1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file VertFlow-0.1.4a1.tar.gz.

File metadata

  • Download URL: VertFlow-0.1.4a1.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for VertFlow-0.1.4a1.tar.gz
Algorithm Hash digest
SHA256 45091005332180714ded84f2d2c2a34aed4e042a9032e9eb934e4f92349721f7
MD5 4ecf53dd3a9c25422722f75968db8381
BLAKE2b-256 f1a83bba3ffcaa4b6d2df006c11d4d4aeed03937cb957a6805968a101c148692

See more details on using hashes here.

File details

Details for the file VertFlow-0.1.4a1-py3-none-any.whl.

File metadata

  • Download URL: VertFlow-0.1.4a1-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for VertFlow-0.1.4a1-py3-none-any.whl
Algorithm Hash digest
SHA256 39be4bca8f8f73b6d04609dd4f928594a24e0df8b6dc2d70601fd11af9c97fd1
MD5 d78490ecb151c46657438c6e7b3cd062
BLAKE2b-256 c95f9bc5b62a26e78baf4cf64e6241554a5125411d0cb619a4add14c44c55efb

See more details on using hashes here.

Supported by

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