kishan agarwal
kishan agarwal

Reputation: 115

After I externally trigger the airflow dag using experimental api it keeps on running and not executing the dag

Airflow Dag:

def print_hello(**kwargs):
    task_params = kwargs['dag_run'].conf['task_payload']
    print('Hello world a with {}'.format(task_params))


def hello_world():
    args = {
        "start_date": datetime(2022, 5, 1),
        "retries": 1,
        "sla": timedelta(hours=3)
    }

    dag_name = 'hello_world_a'
    dag = dag_utils.create_dag(dag_name, args=args, schedule_interval=None)


    test = PythonOperator(
        task_id='hello_world_printer',
        python_callable=print_hello,
        provide_context=True,
        dag=dag)

    with_done_check((test),
                    date_format="{{ ds }}",
                    run_mode=get_mode())

    return dag

Api curl --location --request POST 'http://loclahost:8080/api/experimental/dags/hello_world_a/dag_runs'
--header 'Content-Type: application/json'
--header 'Cache-Control: no-cache'
--data-raw '{"conf":"{"mesage":"test"}"}'

Please let me know why my dag is in running state, but not getting excuted

Upvotes: 0

Views: 277

Answers (1)

Josh Fell
Josh Fell

Reputation: 3589

Try switching the month and day values in start_date. datetime.datetime() is in year/month/day format. Airflow is most likely waiting for May 1.

Upvotes: 0

Related Questions