turbaszek opened a new issue #16009:
URL: https://github.com/apache/airflow/issues/16009


   **Apache Airflow version**: v2.2.0.dev0 
   
   
   **Kubernetes version (if you are using kubernetes)** (use `kubectl version`):
   
   **Environment**:
   Breeze + postgres
   
   **What happened**:
   
   Originally reported on 
[StackOverflow](https://stackoverflow.com/questions/67657260/using-airflow-restapi-to-trigger-dag-doesnt-work-but-clicking-in-ui-does).
   
   It seems that triggering a dag run via API when both execution date and 
dag_run_id are passed results in dag run that is stuck in running state.
   
   **What you expected to happen**:
   
   Triggering dag via API should always result in DAG being executed.
   
   **How to reproduce it**:
   ```py
   import requests
   import json
   from datetime import datetime
   from pprint import pprint
   
   if __name__ == '__main__':
       headers = {
           'accept':'application/json',
           'content-type':'application/json',
       }
       auth = ('admin','admin')
       body = {
           "conf": {},
           "dag_run_id": "testrun01",
           "execution_date":datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ"),
       }
       print(body)
       result = requests.post(
         "http://localhost:28080/api/v1/dags/example_bash_operator/dagRuns";,
           headers=headers,
           auth=auth,
         data=json.dumps(body)
       )
       pprint(result.json())
   ```
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to