A command-line utility for interacting with Apache Airflow REST API
Project description
Airflow CLI Wrapper
A command-line utility for interacting with the Airflow REST API.
Installation
pip install -r requirements.txt
Configuration
Environment Variables
You can set authentication credentials using environment variables:
export AIRFLOW_HOST="airflow.example.com:8080" # Default: localhost:8080
export AIRFLOW_USER="admin"
export AIRFLOW_PASSWORD="your-password"
Command Line Arguments
Command line arguments override environment variables:
python af.py --host airflow.example.com:8080 --user admin --password secret list
Usage
Basic Usage
By default, the tool connects to localhost:8080:
# Using environment variables
python af.py list
# Using command line arguments
python af.py --user admin --password secret status my_dag
Available Commands
List DAGs
python af.py list
python af.py list --limit 10 # Show only 10 DAGs
python af.py list --all # Include inactive DAGs
View DAG Status
python af.py status <dag_id>
Shows DAG configuration and recent runs with color-coded states.
Pause/Unpause DAG
python af.py pause <dag_id>
python af.py unpause <dag_id>
Trigger DAG
python af.py trigger <dag_id>
python af.py trigger <dag_id> --config '{"key": "value"}'
View Tasks and Their Status
python af.py tasks <dag_id>
python af.py tasks <dag_id> --run-id <specific_run_id>
Shows all tasks with color-coded states:
- 🟢 Green: Success
- 🔴 Red: Failed
- 🟡 Yellow: Running/Retry
- 🔵 Blue: Scheduled
- 🟣 Purple: Skipped
View Task Logs
python af.py logs <dag_id> <task_id>
python af.py logs <dag_id> <task_id> --run-id <specific_run_id> --try-number 2
Clear Failed Tasks
# Clear all failed tasks in the latest run
python af.py clear <dag_id>
# Clear a specific task
python af.py clear <dag_id> --task-id <task_id>
# Skip confirmation prompt
python af.py clear <dag_id> -y
Examples
# Set credentials via environment
export AIRFLOW_USER=admin
export AIRFLOW_PASSWORD=secret
# List all DAGs
python af.py list
# Check status of example_dag
python af.py status example_dag
# Trigger example_dag with configuration
python af.py trigger example_dag --config '{"date": "2024-01-01"}'
# View all tasks in the latest run
python af.py tasks example_dag
# View logs for a specific task
python af.py logs example_dag process_data
# Clear all failed tasks
python af.py clear example_dag
Authentication
The tool uses JWT (JSON Web Token) authentication. It automatically obtains a token using the provided credentials and includes it in all API 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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file afcli-0.1.0.tar.gz.
File metadata
- Download URL: afcli-0.1.0.tar.gz
- Upload date:
- Size: 37.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7285ffe7b93006bc443650748b437c45d511d649bc430ffb3787fa7685632da8
|
|
| MD5 |
b6d91a99c9dc60d48f42a56a6fbe6545
|
|
| BLAKE2b-256 |
1d2dd12d698ba69efb3e2a3ed2cbf08458f68d8e81d162ead45b584125cd975a
|
File details
Details for the file afcli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: afcli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
350da34f13fe390ccd2f3de3ef074ef275a2f3ae24c7aeddb5fc6649af80c26d
|
|
| MD5 |
f146ea17aa79e4e89cdab5aee121c4de
|
|
| BLAKE2b-256 |
4137d860916f35524bae48a0fd90b03180d2cdd475d82b4e558b4cf2bfbfcf6e
|