Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@
# specific language governing permissions and limitations
# under the License.

"""
### Bash Decorator Example

This example DAG demonstrates how to use the `@task.bash` decorator
to define tasks that execute Bash commands in Apache Airflow.

It shows:
- Creating Bash tasks using the TaskFlow API
- Passing parameters to Bash commands
- Basic task execution within a decorator-based DAG

This DAG is intended for learning and demonstration purposes.
"""
from __future__ import annotations

import pendulum
Expand All @@ -26,7 +39,7 @@
from airflow.sdk.exceptions import AirflowSkipException


@dag(schedule=None, start_date=pendulum.datetime(2023, 1, 1, tz="UTC"), catchup=False)
@dag(schedule=None, start_date=pendulum.datetime(2023, 1, 1, tz="UTC"), catchup=False, doc_md=__doc__,)
def example_bash_decorator():
@task.bash
def run_me(sleep_seconds: int, task_instance_key_str: str) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,21 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""Example DAG demonstrating the usage of the BashOperator."""

"""
### Example BashOperator DAG

This example DAG demonstrates how to use the **BashOperator** to execute shell commands
as part of an Apache Airflow workflow.

**What this DAG shows:**
- Defining tasks using `BashOperator`
- Executing simple bash commands
- Creating task dependencies, including loops and templated commands

This example is intended for beginners who want to understand how Airflow
interacts with system-level commands using bash.
"""

from __future__ import annotations

Expand All @@ -36,20 +50,7 @@
tags=["example", "example2"],
params={"example_key": "example_value"},
) as dag:
dag.doc_md = """
### Example BashOperator DAG

This DAG demonstrates how to use the **BashOperator** to execute shell commands
as part of an Apache Airflow workflow.

**What this DAG shows:**
- Defining tasks using `BashOperator`
- Executing simple bash commands
- Creating task dependencies, including loops and templated commands

This example is intended for beginners who want to understand how Airflow
interacts with system-level commands using bash.
"""
doc_md=__doc__,

run_this_last = EmptyOperator(
task_id="run_this_last",
Expand Down