I would like to set some parameters to my dag
file. I would like to add two parameters named: is_debug
and seti
. I would also like to set default values
to them so if i do not specify them when running manually a dag
them to be is_debug=False and seti='FG'
. How can i achieve that? Please also instruct me how should i insert the values when triggering manually the dag
from GUI
in Configuration JSON (Optional): {}
This is my dag:
import lib.log as log
import traceback
import datetime
import json
def my_main(**kwargs):
try:
#if is_debug == True:
# log.log_it('U in debug mode')
#else:
log.log_it('U in normal mode')
#if seti == 'FG':
# log.log_it('FG')
#else:
# log.log_it('RX')
from airflow import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import PythonOperator
dag = DAG(
'my_main',
description='my_main',
start_date=datetime.datetime(2023,6,8,1,0),
schedule_interval="0 1 * * *",
catchup=False
)
task_my_main = PythonOperator(task_id='task_my_main_main', provide_context=True, python_callable=my_main, dag=dag)