This is my scriptlet for triggerring the python script.
task1= BashOperator(
task_id='task1_monthly_run',
bash_command="python /opt/airflow/dags/scripts/validation/runner.py arg1 arg2",
dag=dag)
I give 2 args for using in py script. Because I use same script for different args.
this is from runner.py to show the usage of args:
import sys
arg_list = sys.argv[1:]
model_name = arg_list[0]
val_date_son = arg_list[1]
Code works fine. args pass fine. But Airflow UI shows error about args:
Broken DAG: [/opt/airflow/dags/scripts/validation/runner.py] Traceback (most recent call last): File "", line 219, in _call_with_frames_removed File "/opt/airflow/dags/scripts/validation/runner.py", line 10, in val_date_son = arg_list1 IndexError: list index out of range
How can i get rid of this error?