Skip to main content

Serverless Airflow Executor on Modal

Project description

Modalflow

A serverless Airflow Executor for Modal.

Usage

Prerequisites

  • pip
  • A Modal account, workspace, and environment
  • Modal CLI configured to your workspace

Steps

  1. pip install modalflow on your local machine, and add it to your Airflow cluster.
  2. Run modalflow deploy --env {environment name} to deploy the resources into your Modal environment.
  3. Add modalflow.executor.ModalExecutor to your Airflow config

Networking Configuration

Local Development

ModalExecutor automatically detects when you're running Airflow locally and creates a tunnel to your local Airflow instance (localhost:8080). No additional configuration needed.

The executor will:

  • Detect if localhost:8080 is accessible
  • Create a Modal tunnel to expose your local Airflow API
  • Pass the tunnel URL to Modal Functions so they can "phone home"

Production / VPC Deployments

If your Airflow deployment is in a VPC or behind a firewall, you need to configure the execution API URL so Modal Functions can reach it.

Option 1: Environment Variable (Recommended)

Set the execution API URL as an environment variable:

export AIRFLOW__CORE__EXECUTION_API_SERVER_URL=https://your-airflow-api.example.com/execution/

Option 2: Airflow Config

Set in airflow.cfg:

[core]
execution_api_server_url = https://your-airflow-api.example.com/execution/

VPC Setup Considerations

If Airflow is deployed in a VPC, ensure:

  • Public Endpoint: Airflow API must be accessible via a public endpoint. Options include:

    • Application Load Balancer (ALB) in public subnets
    • API Gateway in front of Airflow
    • Reverse tunnel (ngrok, Cloudflare Tunnel, AWS IoT Secure Tunneling)
  • Security: Use authentication/authorization to protect the endpoint:

    • API keys or bearer tokens
    • Security groups restricting access
    • VPN or private networking (if Modal supports VPC peering)
  • Network Access: Modal Functions run in Modal's cloud infrastructure and can reach public internet endpoints. Ensure:

    • No firewall rules blocking Modal's IP ranges
    • The endpoint is reachable from the internet (not just internal VPC)

Example: Using Reverse Tunnel

If you can't expose Airflow directly, use a reverse tunnel:

  1. Set up ngrok or similar: ngrok http 8080
  2. Configure the executor with the ngrok URL:
    export AIRFLOW__CORE__EXECUTION_API_SERVER_URL=https://abc123.ngrok.io/execution/
    

Development

We use uv for development. To setup:

  1. cd modalflow
  2. uv sync
  3. To run the CLI, use: uv run -- modalflow [COMMAND]
  4. To run unit tests, use: uv run pytest

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

modalflow-0.2.2.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

modalflow-0.2.2-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file modalflow-0.2.2.tar.gz.

File metadata

  • Download URL: modalflow-0.2.2.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for modalflow-0.2.2.tar.gz
Algorithm Hash digest
SHA256 1a46cbddda56c30ecdcb091b14b216f83d2f03c3712591661b4298f3b6914cf4
MD5 15efe20a9b3e46fc74ec3b37e7b518f3
BLAKE2b-256 14b68d1f2b0d5201dd670aa75175a0ad1fcdc931eb848e97c0714da7f8cf6c2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for modalflow-0.2.2.tar.gz:

Publisher: publish.yml on agupta01/modalflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modalflow-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: modalflow-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for modalflow-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cc4004db2b9175063e60008e92fea649653e5bfba25fcb395efada0bd6d85740
MD5 470b26934f76cf447cb10a29b3eef0e5
BLAKE2b-256 3c8dfc88ce48cbcf3245ce062cd531a0cb1491a1dc8c5d013ae3b5b1e24cff02

See more details on using hashes here.

Provenance

The following attestation bundles were made for modalflow-0.2.2-py3-none-any.whl:

Publisher: publish.yml on agupta01/modalflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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