Skip to main content

airflow-docker

CircleCI Codacy Badge codecov

Description

An opinionated implementation of exclusively using airflow DockerOperators for all Operators.

Default Operator

from airflow_docker.operator import Operator

task = Operator(
    image='some-image:latest',
    ...
)

Default Sensor

from airflow_docker.operator import Sensor

sensor = Sensor(
    image='some-image:latest',
    ...
)

Task Code

from airflow_docker_helper import client

client.sensor(True)

Branch Operator

Dag Task

from airflow_docker.operator import BranchOperator

branching_task = BranchOperator(
    image='some-image:latest',
    ...
)

Task Code

from airflow_docker_helper import client

client.branch_to_tasks(['task1', 'task2'])

Short Circuit Operator

Dag Task

from airflow_docker.operator import ShortCircuitOperator

short_circuit = ShortCircuitOperator(
    image='some-image:latest',
    ...
)

Task Code

from airflow_docker_helper import client

client.short_circuit()  # This task will short circuit if this function gets called

Context Usage

Dag Task

from airflow_docker.operator import Operator

task = Operator(
    image='some-image:latest',
    provide_context=True,
    ...
)

Task Code

from airflow_docker_helper import client

context = client.context()

Configuration

The following operator defaults can be set under the airflowdocker namespace:

  • force_pull (boolean true/false)
  • auto_remove (boolean true/false)
  • network_mode

For example, to set force_pull to False by default set the following environment variable like so:

export AIRFLOW__AIRFLOWDOCKER__FORCE_PULL=false

Plugin

This package works as an airflow plugin as well. When installed and running airflow, dags can import like so

from airflow.{type, like "operators", "sensors"}.{name specificed inside the plugin class} import *

i.e.

from airflow.operators.airflow_docker import Operator

Tests

We also ship an airflowdocker/tester image to verify the integrity of your DAG definitions before committing them.

One can run the tests against your own dags like so:

docker run -it -v "${pwd}/dags:/airflow/dags" airflowdocker/tester

or else see the airflow-docker-compose project which ships with a test subcommand for precisely this purpose.

Metadata

Release files for airflow-docker 2.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for airflow-docker 2.1.1
File Size Uploaded Provenance Actions
airflow-docker-2.1.1.tar.gz 17.5 kB Without provenance Details for airflow-docker-2.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for airflow-docker 2.1.1
File Interpreter ABI Platform Actions
airflow_docker-2.1.1-py2.py3-none-any.whl Python 2, Python 3 none any Details for airflow_docker-2.1.1-py2.py3-none-any.whl

Total release size: 38.2 kB

Release files / airflow-docker-2.1.1.tar.gz

Download URL airflow-docker-2.1.1.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
28149435931b29ded3c196ad48c6a22219870df036cda164eddfb19c69a41f35
BLAKE2b-256 checksum
How to use checksums
2913f54226f8d4d3d0840b661df0f7f7067cbedce39c311cd6572b30961a6c9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.6.11

Release files / airflow_docker-2.1.1-py2.py3-none-any.whl

Download URL airflow_docker-2.1.1-py2.py3-none-any.whl
Size 20.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
f85b85f95c7a675c1159cd1f37f12d13344007eef005e45fb191bee81442eb47
BLAKE2b-256 checksum
How to use checksums
21ac91322f7b8a284a3f305255dad805f85ccd45365f87203a2fa6eb88f60cea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.6.11

Security for airflow-docker 2.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page