You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "tirkarthi (via GitHub)" <gi...@apache.org> on 2025/03/11 12:44:46 UTC

[I] Dagrun with null logical date results in task-sdk API error [airflow]

tirkarthi opened a new issue, #47612:
URL: https://github.com/apache/airflow/issues/47612

   ### Apache Airflow version
   
   main (development)
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   It seems that the task-sdk is trying to get the previous successful dagrun and in case of dagruns created with logical_date as null this is causing below stacktrace in the API server logs.
   
   Relevant part where there seems to be None comparison query
   
   ```
     File "/home/karthikeyan/stuff/python/airflow/airflow/api_fastapi/execution_api/routes/task_instances.py", line 510, in get_previous_successful_dagrun
       DR.logical_date < task_instance.logical_date,
   ```
   
   Full log
   
   ```
   [2025-03-11T17:58:22.093+0530] {httptools_impl.py:414} ERROR - Exception in ASGI application
   
   Traceback (most recent call last):
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 409, in run_asgi
       result = await app(  # type: ignore[func-returns-value]
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
       return await self.app(scope, receive, send)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
       await super().__call__(scope, receive, send)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/applications.py", line 112, in __call__
       await self.middleware_stack(scope, receive, send)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 187, in __call__
       raise exc
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 165, in __call__
       await self.app(scope, receive, _send)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/middleware/gzip.py", line 29, in __call__
       await responder(scope, receive, send)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/middleware/gzip.py", line 126, in __call__
       await super().__call__(scope, receive, send)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/middleware/gzip.py", line 46, in __call__
       await self.app(scope, receive, self.send_with_compression)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/middleware/cors.py", line 85, in __call__
       await self.app(scope, receive, send)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/middleware/base.py", line 181, in __call__
       raise app_exc
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/middleware/base.py", line 140, in coro
       await self.app(scope, receive_or_disconnect, send_no_error)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
       await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
       raise exc
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
       await app(scope, receive, sender)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/routing.py", line 714, in __call__
       await self.middleware_stack(scope, receive, send)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/routing.py", line 734, in app
       await route.handle(scope, receive, send)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/routing.py", line 460, in handle
       await self.app(scope, receive, send)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
       await super().__call__(scope, receive, send)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/applications.py", line 112, in __call__
       await self.middleware_stack(scope, receive, send)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 187, in __call__
       raise exc
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 165, in __call__
       await self.app(scope, receive, _send)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
       await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
       raise exc
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
       await app(scope, receive, sender)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/routing.py", line 714, in __call__
       await self.middleware_stack(scope, receive, send)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/routing.py", line 734, in app
       await route.handle(scope, receive, send)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
       await self.app(scope, receive, send)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/routing.py", line 76, in app
       await wrap_app_handling_exceptions(app, request)(scope, receive, send)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
       raise exc
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
       await app(scope, receive, sender)
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/routing.py", line 73, in app
       response = await f(request)
                  ^^^^^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 301, in app
       raw_response = await run_endpoint_function(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 214, in run_endpoint_function
       return await run_in_threadpool(dependant.call, **values)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/starlette/concurrency.py", line 37, in run_in_threadpool
       return await anyio.to_thread.run_sync(func)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
       return await get_async_backend().run_sync_in_worker_thread(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2461, in run_sync_in_worker_thread
       return await future
              ^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 962, in run
       result = context.run(func, *args)
                ^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/airflow/api_fastapi/execution_api/routes/task_instances.py", line 510, in get_previous_successful_dagrun
       DR.logical_date < task_instance.logical_date,
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/sqlalchemy/sql/operators.py", line 368, in __lt__
       return self.operate(lt, other)
              ^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 322, in operate
       return op(self.comparator, *other, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/sqlalchemy/sql/operators.py", line 368, in __lt__
       return self.operate(lt, other)
              ^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/sqlalchemy/orm/properties.py", line 426, in operate
       return op(self.__clause_element__(), *other, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/sqlalchemy/sql/operators.py", line 368, in __lt__
       return self.operate(lt, other)
              ^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/sqlalchemy/sql/elements.py", line 873, in operate
       return op(self.comparator, *other, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/sqlalchemy/sql/operators.py", line 368, in __lt__
       return self.operate(lt, other)
              ^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/sqlalchemy/sql/type_api.py", line 1379, in operate
       return super(TypeDecorator.Comparator, self).operate(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/sqlalchemy/sql/type_api.py", line 77, in operate
       return o[0](self.expr, op, *(other + o[1:]), **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/sqlalchemy/sql/default_comparator.py", line 95, in _boolean_compare
       raise exc.ArgumentError(
   sqlalchemy.exc.ArgumentError: Only '=', '!=', 'is_()', 'is_not()', 'is_distinct_from()', 'is_not_distinct_from()' operators can be used with None/True/False
   
   ```
   
   ### What you think should happen instead?
   
   _No response_
   
   ### How to reproduce
   
   1. Create a dagrun with empty logical_date in the trigger form.
   2. Check the logs in fastapi.
   
   ### Operating System
   
   Ubuntu 20.03
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Virtualenv installation
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.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: commits-unsubscribe@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dagrun with null logical date results in task-sdk API error [airflow]

Posted by "tirkarthi (via GitHub)" <gi...@apache.org>.
tirkarthi commented on issue #47612:
URL: https://github.com/apache/airflow/issues/47612#issuecomment-2736364983

   I think you need two dagruns here. First one with null logical date. Then another dagrun.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dagrun with null logical date results in task-sdk API error [airflow]

Posted by "sk-shakeel (via GitHub)" <gi...@apache.org>.
sk-shakeel commented on issue #47612:
URL: https://github.com/apache/airflow/issues/47612#issuecomment-2716763674

   Hi @tirkarthi 
   I want to work on this issue. Can you assign this issue to me?


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dagrun with null logical date results in task-sdk API error [airflow]

Posted by "s-vasu (via GitHub)" <gi...@apache.org>.
s-vasu commented on issue #47612:
URL: https://github.com/apache/airflow/issues/47612#issuecomment-2736184745

   I've to tried reproduce the issue with breeze setup by creating a dagrun with empty logical_date in the trigger form (tried in UI and also in CLI), but I didn't find any error logs in API Server section, everything seems to be fine.
   
   please refer the below screenshot below and provide any suggestions
   
   ![Image](https://github.com/user-attachments/assets/c7e6f8ae-1f8c-49ed-ab58-4b7ed3b18f21)


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dagrun with null logical date results in task-sdk API error [airflow]

Posted by "tirkarthi (via GitHub)" <gi...@apache.org>.
tirkarthi commented on issue #47612:
URL: https://github.com/apache/airflow/issues/47612#issuecomment-2716812526

   @sk-shakeel I am not working on this. Feel free to pick it up. Thanks.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dagrun with null logical date results in task-sdk API error [airflow]

Posted by "s-vasu (via GitHub)" <gi...@apache.org>.
s-vasu commented on issue #47612:
URL: https://github.com/apache/airflow/issues/47612#issuecomment-2736396902

   > I think you need two dagruns here. First one with null logical date. Then another dagrun.
   
   Thank you for the reply.
   
   What about second dagrun, should I rerun the same DAG with logical date (I tried it also but no error in logs) and it is  mentioned single dagrun in the description.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dagrun with null logical date results in task-sdk API error [airflow]

Posted by "tirkarthi (via GitHub)" <gi...@apache.org>.
tirkarthi commented on issue #47612:
URL: https://github.com/apache/airflow/issues/47612#issuecomment-2736962987

   Sorry, first dagrun with null logical date and then a new dagrun with a logical date. I will update the description.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dagrun with null logical date results in task-sdk API error [airflow]

Posted by "s-vasu (via GitHub)" <gi...@apache.org>.
s-vasu commented on issue #47612:
URL: https://github.com/apache/airflow/issues/47612#issuecomment-2739081484

   @tirkarthi ,
   I followed the same instructions as mentioned in the updated description with two dagruns below is the screenshot of it
   
   ![Image](https://github.com/user-attachments/assets/30186449-dbf2-4050-a067-6232fa7f909f)
   
   here, I can't find any error logs so, please confirm whether I followed the steps properly or anything wrong in it. 


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dagrun with null logical date results in task-sdk API error [airflow]

Posted by "tirkarthi (via GitHub)" <gi...@apache.org>.
tirkarthi commented on issue #47612:
URL: https://github.com/apache/airflow/issues/47612#issuecomment-2744048542

   @s-vasu  Can you please try triggering `example_python_decorator` example dag from UI with no logical_date ?


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dagrun with null logical date results in task-sdk API error [airflow]

Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil closed issue #47612: Dagrun with null logical date results in task-sdk API error
URL: https://github.com/apache/airflow/issues/47612


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org