- Newest
- Most votes
- Most comments
Hello,
The issue mentioned in https://github.com/apache/airflow/discussions/23808 seems to be a general issue with respect to Airflow and not particularly related to MWAA. However, I have used the below code to replicate the issue at my end and we could see that the code ran without any issue. Hence, request you to please reach out to support engineering to address your specific issue.
Below is the code for base DAG that will be triggered using the trigger DAG:
—————————————
""" Code that goes along with the Airflow located at: http://airflow.readthedocs.org/en/latest/tutorial.html """
from airflow import DAG from airflow.operators.bash_operator import BashOperator from datetime import datetime, timedelta
default_args = { "owner": "airflow", "start_date": datetime(2022, 4, 1), "email": ["airflow@airflow.com"], "email_on_failure": False, "email_on_retry": False, "retries": 1, "depends_on_past": True, "retry_delay": timedelta(minutes=5) }
dag = DAG("tutorial_depend", default_args=default_args, catchup=False, schedule_interval='@daily')
t1 = BashOperator(task_id="print_date", bash_command="sleep 5", dag=dag)
t2 = BashOperator(task_id="sleep", bash_command="sleep 5", retries=3, dag=dag)
templated_command = """ {% for i in range(5) %} echo "{{ ds }}" echo "{{ macros.ds_add(ds, 7)}}" echo "{{ params.my_param }}" {% endfor %} """
t3 = BashOperator( task_id="templated", bash_command=templated_command, params={"my_param": "Parameter I passed in"}, dag=dag, )
t2.set_upstream(t1) t3.set_upstream(t1)
—————————————
Trigger DAG code : The command was passed in the form of JSON { "command" : "airflow dags backfill -x -s '2022-04-02' -e '2022-04-12' --rerun-failed-tasks tutorial_depend"}
—————————————
from airflow import DAG from airflow.operators.bash_operator import BashOperator from airflow.utils.dates import days_ago with DAG(dag_id="any_bash_command_dag", schedule_interval=None, catchup=False, start_date=days_ago(1)) as dag: cli_command = BashOperator( task_id="bash_command", bash_command="{{ dag_run.conf['command'] }}” )
—————————————
================
Have a nice day!
Relevant content
- asked 3 years ago
- Accepted Answerasked 2 years ago
- asked 3 years ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago