This tool generates Airflow DAG files from a JSON configuration file, with a user-friendly web interface for creating and visualizing DAGs.
.
├── ui/ # Frontend React application
│ ├── src/ # React source code
│ ├── public/ # Static files
│ └── package.json # Frontend dependencies
├── dag_generator/ # Backend Python package
│ ├── core/ # Core generation logic
│ ├── utils/ # Utility functions
│ └── tests/ # Unit tests
├── main.py # Main entry point
├── requirements.txt # Python dependencies
└── README.md # This file
- Python 3.8 or higher
- Node.js 14 or higher
- npm or yarn
- Create and activate a Python virtual environment (recommended):
# Windows
python -m venv venv
venv\Scripts\activate
# Linux/Mac
python3 -m venv venv
source venv/bin/activate- Install the required Python dependencies:
pip install -r requirements.txt- Verify the installation:
python -m main -jfp sample_dag.json- Navigate to the frontend directory:
cd ui- Install Node.js dependencies:
npm install
# or if using yarn
yarn install- Start the frontend development server (in one terminal):
cd ui
npm start
# or
yarn start- The backend will be used when generating DAGs from the UI.
-
Use the web interface to:
- Create tasks by selecting operators and configuring them
- Define dependencies between tasks by connecting them
- Set DAG-level configurations (schedule, start date, etc.)
-
Export the DAG configuration:
- Click the "Generate DAG JSON" button to download the JSON configuration
- Save the file (e.g.,
my_dag.json)
-
Generate the DAG file:
python -m main -jfp my_dag.jsonThe generated DAG file will be created in the output/dags directory.
The JSON configuration should follow this structure:
{
"dag_id": "your_dag_id",
"description": "DAG description",
"schedule_interval": "@daily",
"start_date": "YYYY-MM-DD",
"catchup": false,
"tasks": [
{
"task_id": "task_name",
"operator_type": "OperatorType",
"config": {
// Operator specific configuration
}
}
],
"dependencies": [
{
"source": "task_id_1",
"target": "task_id_2"
}
]
}- PythonOperator
- BashOperator
- PostgresOperator
- EmailOperator
- HttpOperator
- S3Hook
- FileSensor
- TimeSensor
- SqlSensor
- DockerOperator
- SlackWebhookOperator
# Backend tests
pytest dag_generator/tests/
# Frontend tests (from ui directory)
cd ui
npm test
# or
yarn testThe project follows PEP 8 style guidelines for Python and ESLint for JavaScript. Use linters to ensure code quality:
# Python linting
flake8 dag_generator/
# JavaScript linting (from ui directory)
cd ui
npm run lint
# or
yarn lint-
If the UI fails to start:
- Ensure Node.js is installed
- Check if port 3000 is available
- Verify all frontend dependencies are installed
- Try clearing npm cache:
npm cache clean --force
-
If DAG generation fails:
- Check if all required Python packages are installed
- Verify the JSON configuration format
- Ensure the output directory is writable
- Check Python virtual environment is activated
-
Common issues:
- Missing dependencies: Run
pip install -r requirements.txtagain - Port conflicts: Change the frontend port in
package.json - Permission errors: Check directory permissions in
output/ - Node modules issues: Delete
node_modulesand runnpm installagain
- Missing dependencies: Run