Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example DAG for task group #293

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions dev/dags/example_task_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os
from pathlib import Path

# The following import is here so Airflow parses this file
# from airflow import DAG
import dagfactory

DEFAULT_CONFIG_ROOT_DIR = "/usr/local/airflow/dags/"
CONFIG_ROOT_DIR = Path(os.getenv("CONFIG_ROOT_DIR", DEFAULT_CONFIG_ROOT_DIR))

config_file = str(CONFIG_ROOT_DIR / "example_task_group.yml")

example_dag_factory = dagfactory.DagFactory(config_file)

# Creating task dependencies
example_dag_factory.clean_dags(globals())
example_dag_factory.generate_dags(globals())
30 changes: 30 additions & 0 deletions dev/dags/example_task_group.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
default:
default_args:
owner: default_owner
retries: 1
retry_delay_sec: 300
start_date: 2024-01-01
default_view: tree
max_active_runs: 1
schedule_interval: 0 1 * * *
example_task_group:
description: "this dag uses task groups"
task_groups:
task_group_1:
tooltip: "this is a task group"
dependencies: [task_1]
task_group_2:
tooltip: "this is a task group"
parent_group_name: task_group_1
tasks:
task_1:
operator: airflow.operators.bash_operator.BashOperator
bash_command: "echo 1"
task_2:
operator: airflow.operators.bash_operator.BashOperator
bash_command: "echo 2"
task_group_name: task_group_1
task_4:
operator: airflow.operators.bash_operator.BashOperator
bash_command: "echo 4"
task_group_name: task_group_2