humit0 opened a new pull request #19672:
URL: https://github.com/apache/airflow/pull/19672


   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   Log endpoint API raise exception when same `task_id` with different `dag_id`.
   
   ```
   Traceback (most recent call last):
     File &#34;/opt/app-root/lib64/python3.8/site-packages/flask/app.py&#34;, 
line 2447, in wsgi_app
       response = self.full_dispatch_request()
     File &#34;/opt/app-root/lib64/python3.8/site-packages/flask/app.py&#34;, 
line 1952, in full_dispatch_request
       rv = self.handle_user_exception(e)
     File &#34;/opt/app-root/lib64/python3.8/site-packages/flask/app.py&#34;, 
line 1821, in handle_user_exception
       reraise(exc_type, exc_value, tb)
     File 
&#34;/opt/app-root/lib64/python3.8/site-packages/flask/_compat.py&#34;, line 
39, in reraise
       raise value
     File &#34;/opt/app-root/lib64/python3.8/site-packages/flask/app.py&#34;, 
line 1950, in full_dispatch_request
       rv = self.dispatch_request()
     File &#34;/opt/app-root/lib64/python3.8/site-packages/flask/app.py&#34;, 
line 1936, in dispatch_request
       return self.view_functions[rule.endpoint](**req.view_args)
     File 
&#34;/opt/app-root/lib64/python3.8/site-packages/airflow/_vendor/connexion/decorators/decorator.py&#34;,
 line 48, in wrapper
       response = function(request)
     File 
&#34;/opt/app-root/lib64/python3.8/site-packages/airflow/_vendor/connexion/decorators/uri_parsing.py&#34;,
 line 144, in wrapper
       response = function(request)
     File 
&#34;/opt/app-root/lib64/python3.8/site-packages/airflow/_vendor/connexion/decorators/validation.py&#34;,
 line 384, in wrapper
       return function(request)
     File 
&#34;/opt/app-root/lib64/python3.8/site-packages/airflow/_vendor/connexion/decorators/response.py&#34;,
 line 103, in wrapper
       response = function(request)
     File 
&#34;/opt/app-root/lib64/python3.8/site-packages/airflow/_vendor/connexion/decorators/parameter.py&#34;,
 line 121, in wrapper
       return function(**kwargs)
     File 
&#34;/opt/app-root/lib64/python3.8/site-packages/airflow/api_connexion/security.py&#34;,
 line 47, in decorated
       return func(*args, **kwargs)
     File 
&#34;/opt/app-root/lib64/python3.8/site-packages/airflow/utils/session.py&#34;, 
line 70, in wrapper
       return func(*args, session=session, **kwargs)
     File 
&#34;/opt/app-root/lib64/python3.8/site-packages/airflow/api_connexion/endpoints/log_endpoint.py&#34;,
 line 64, in get_log
       session.query(TaskInstance)
     File 
&#34;/opt/app-root/lib64/python3.8/site-packages/sqlalchemy/orm/query.py&#34;, 
line 3467, in one_or_none
       raise orm_exc.MultipleResultsFound(
   sqlalchemy.orm.exc.MultipleResultsFound: Multiple rows were found for 
one_or_none()
   ```
   
   So, I add `dag_id` filter to get unique task_instance.
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)**
 for more information.
   In case of fundamental code change, Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals))
 is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party 
License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in 
[UPDATING.md](https://github.com/apache/airflow/blob/main/UPDATING.md).
   


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