MaksYermak commented on code in PR #67601:
URL: https://github.com/apache/airflow/pull/67601#discussion_r3317490529


##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/dag_runs.py:
##########
@@ -153,6 +153,14 @@ def trigger_dag_run(
                 "message": f"A run already exists for Dag '{dag_id}' with 
run_id '{run_id}'",
             },
         )
+    except ValueError as e:

Review Comment:
   Hi @SameerMesiah97 ,
   I have tried to cover these `ValueError`s 
https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/serialization/definitions/dag.py#L544-L581
 from `create_dagrun` function which run inside `trigger_dag` function under 
`trigger_dar_run` API call. Because in the current time users see this error:
   ```
   Top level error
   Traceback (most recent call last):
     File 
"/opt/python3.11/lib/python3.11/site-packages/airflow/sdk/execution_time/task_runner.py",
 line 920, in run
       result = _execute_task(context=context, ti=ti, log=log)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/opt/python3.11/lib/python3.11/site-packages/airflow/sdk/execution_time/task_runner.py",
 line 1307, in _execute_task
       result = ctx.run(execute, context=context)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/opt/python3.11/lib/python3.11/site-packages/airflow/sdk/bases/operator.py", 
line 416, in wrapper
       return func(self, *args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/opt/python3.11/lib/python3.11/site-packages/airflow/providers/standard/operators/trigger_dagrun.py",
 line 258, in execute
       self._trigger_dag_af_3(
     File 
"/opt/python3.11/lib/python3.11/site-packages/airflow/providers/standard/operators/trigger_dagrun.py",
 line 269, in _trigger_dag_af_3
       raise DagRunTriggerException(
   airflow.exceptions.DagRunTriggerException
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File 
"/opt/python3.11/lib/python3.11/site-packages/airflow/sdk/execution_time/task_runner.py",
 line 1450, in main
       state, _, error = run(ti, context, log)
                         ^^^^^^^^^^^^^^^^^^^^^
     File 
"/opt/python3.11/lib/python3.11/site-packages/airflow/composer/patches/metrics/monkey_patching/airflow_sdk_execution_time_task_runner.py",
 line 36, in wrapper
       state, msg, error = f(ti, *args, **kwargs)
                           ^^^^^^^^^^^^^^^^^^^^^^
     File 
"/opt/python3.11/lib/python3.11/site-packages/airflow/sdk/execution_time/task_runner.py",
 line 940, in run
       msg, state = _handle_trigger_dag_run(drte, context, ti, log)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/opt/python3.11/lib/python3.11/site-packages/airflow/sdk/execution_time/task_runner.py",
 line 1053, in _handle_trigger_dag_run
       comms_msg = SUPERVISOR_COMMS.send(
                   ^^^^^^^^^^^^^^^^^^^^^^
     File 
"/opt/python3.11/lib/python3.11/site-packages/airflow/sdk/execution_time/comms.py",
 line 207, in send
       return self._get_response()
              ^^^^^^^^^^^^^^^^^^^^
     File 
"/opt/python3.11/lib/python3.11/site-packages/airflow/sdk/execution_time/comms.py",
 line 271, in _get_response
       return self._from_frame(frame)
              ^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/opt/python3.11/lib/python3.11/site-packages/airflow/sdk/execution_time/comms.py",
 line 258, in _from_frame
       raise AirflowRuntimeError(error=err)
   airflow.sdk.exceptions.AirflowRuntimeError: API_SERVER_ERROR: 
{'status_code': 500, 'message': 'Server returned error', 'detail': {'message': 
'Internal server error', 'correlation-id': 
'002dab06-ee5b-8be7-a321-7b13b5311915'}}
   
   ```
   with `500` status code and unclear error message:
   ```
   {'status_code': 500, 'message': 'Server returned error', 'detail': 
{'message': 'Internal server error', 'correlation-id': 
'002dab06-ee5b-8be7-a321-7b13b5311915'}}
   ```
   



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to