from airflow import DAG
from airflow.utils.dates import days_ago
from airflow.operators.bash import BashOperator
from airflow.operators.python import PythonOperator
# for python operator
def test(ds, **kwargs):
print(f"{kwargs['dag_run'].conf['message']}")
with DAG(
dag_id='test',
start_date=days_ago(2),
schedule_interval=None) as dag:
py_test = PythonOperator(
task_id='test_python',
provide_context=True,
python_callable=test,
dag=dag)
bash_test = BashOperator(
task_id='test_bash',
bash_command='echo "here is message: "'
'{dag_run.conf["message" if dag_run else ""]}',
dag=dag)
py_test >> bash_test
using the airflow UI, you can use "Actions".
Write the args in json format.