Skip to main content

Airflow Bootstrap Utils

Collection of Python tools to generate Airflow DAGs from control and configuration files.

Exported Console Scripts

  • airflow-generate-dag: Generate Airflow DAGs from control and configuration files.

  • airflow-validate-control-file: Validate control files.

Installation

`shell pip install airflow-bootstrap-utils `

Usage

generate-airflow-dag-script --control_file /tmp/airflow-demo/simple_workflow.yaml --outdir /tmp/airflow-demo
--config_file was not specified and therefore was set to '/tmp/airflow-bootstrap-utils/venv/lib/python3.10/site-packages/airflow_bootstrap_utils/conf/config.yaml'
--template_dir was not specified and therefore was set to '/tmp/airflow-bootstrap-utils/venv/lib/python3.10/site-packages/airflow_bootstrap_utils/templates'
--logfile was not specified and therefore was set to '/tmp/airflow-demo/generate_dag.log'
Wrote Airflow DAG Python script list to file '/tmp/sundaram/airflow-bootstrap-utils/user_processing_L2/2025-02-15-101314/airflow_dag_scripts.txt'

Contents of airflow_dag_scripts.txt:

cat /tmp/sundaram/airflow-bootstrap-utils/user_processing_L2/2025-02-15-101314/airflow_dag_scripts.txt
## method-created: /tmp/airflow-bootstrap-utils/venv/lib/python3.10/site-packages/airflow_bootstrap_utils/manager.py
## date-created: 2025-02-15-101314
## created-by: sundaram
## control-file: /tmp/airflow-demo/simple_workflow.yaml
## logfile: /tmp/airflow-demo/generate_dag.log
/tmp/sundaram/airflow-bootstrap-utils/user_processing_L1/2025-02-15-101314/L1/user_processing_L1.airflow.dag.py
/tmp/sundaram/airflow-bootstrap-utils/user_processing_L2/2025-02-15-101314/L2/user_processing_L2.airflow.dag.py

Contents of L1 airflow script:

from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime

#------------------------------
# Airflow DAG definition
#------------------------------
dag = DAG(
    'user_processing_L1',
    description='This is an example DAG in the airflow-bootstrap-utils.  Please provide a better description in your instance in your copy of the control file.',
    schedule_interval='“@weekly”',
    start_date=datetime(2024,3,22),
    catchup=False,
    )

#------------------------------
# Airflow task defintions
#------------------------------

"""
The do_something executable is going to do something.
It is going to use the lab number argument to do
something.
The lab number is a required parameter.
"""
do_something = BashOperator(
    task_id='do_something',
    bash_command='bash /opt/do_something.sh --lab_number L1',
    dag=dag
)


"""
The do_something_else executable is going to do something else.
It is going to use the lab number argument to do
something else.
The lab number is a required parameter.
"""
do_something_else = BashOperator(
    task_id='do_something_else',
    bash_command='bash /opt/do_something_else.sh --lab_number L1',
    dag=dag
)

#------------------------------
# Define the task dependencies
#------------------------------
do_something >> do_something_else

Contents of L2 airflow script:

from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime

#------------------------------
# Airflow DAG definition
#------------------------------
dag = DAG(
    'user_processing_L2',
    description='This is an example DAG in the airflow-bootstrap-utils.  Please provide a better description in your instance in your copy of the control file.',
    schedule_interval='“@weekly”',
    start_date=datetime(2024,3,22),
    catchup=False,
    )

#------------------------------
# Airflow task defintions
#------------------------------

"""
The do_something executable is going to do something.
It is going to use the lab number argument to do
something.
The lab number is a required parameter.
"""
do_something = BashOperator(
    task_id='do_something',
    bash_command='bash /opt/do_something.sh --lab_number L1',
    dag=dag
)


"""
The do_something_else executable is going to do something else.
It is going to use the lab number argument to do
something else.
The lab number is a required parameter.
"""
do_something_else = BashOperator(
    task_id='do_something_else',
    bash_command='bash /opt/do_something_else.sh --lab_number L1',
    dag=dag
)

#------------------------------
# Define the task dependencies
#------------------------------
do_something >> do_something_else

History

0.1.0 (2024-03-20)

  • First release on PyPI.

Metadata

Release files for airflow-bootstrap-utils 0.2.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-bootstrap-utils 0.2.1
File Size Uploaded
airflow_bootstrap_utils-0.2.1.tar.gz 18.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for airflow-bootstrap-utils 0.2.1
File Interpreter ABI Platform
airflow_bootstrap_utils-0.2.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 34.1 kB

Release files / airflow_bootstrap_utils-0.2.1.tar.gz

Download URL airflow_bootstrap_utils-0.2.1.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ee522e658c1882629397aadf974224970ff8617debf6efa3627fcff17a3e8254
BLAKE2b-256 checksum
How to use checksums
7a885c03778c5de215e6f1e8209dd9fcf07e2c5bfea1781155c83bebe570a16f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.12

Release files / airflow_bootstrap_utils-0.2.1-py2.py3-none-any.whl

Download URL airflow_bootstrap_utils-0.2.1-py2.py3-none-any.whl
Size 15.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
f5507e584ff5b97288eacacb3a3fd270ae7b6a40308fdf377b53aecb6244414d
BLAKE2b-256 checksum
How to use checksums
aad4035cabd2a2bf5d145bdec91f6c3985e9a08f0930ff9dc5d52da646e5c841
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

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