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

   ### Apache Airflow version
   
   main (development)
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   `NameError` on task execution completion using LocalExecutor . It looks like 
`block_orm_access` deletes these attributes from settings module and the 
registered lambda functions runs after the attributes have been deleted. 
Probably instead set them to None and run the lambda only when the value is not 
None like `os.register_at_fork(after_in_child=lambda: engine and 
engine.dispose(close=False))`
   
   
https://github.com/apache/airflow/blob/a3435f11bbf2c2c487ec1be53e21ab574f119b61/task-sdk/src/airflow/sdk/execution_time/supervisor.py#L223-L242
   
   ```
   [2025-03-13, 06:23:01] ERROR - Exception ignored in: <function 
configure_orm.<locals>.<lambda> at 0x7f9a6bddb880> chan="stderr" source="task"
   [2025-03-13, 06:23:01] ERROR - Traceback (most recent call last): 
chan="stderr" source="task"
   [2025-03-13, 06:23:01] ERROR -   File 
"/home/karthikeyan/stuff/python/airflow/airflow/settings.py", line 392, in 
<lambda> chan="stderr" source="task"
   [2025-03-13, 06:23:01] ERROR -     
os.register_at_fork(after_in_child=lambda: engine.dispose(close=False)) 
chan="stderr" source="task"
   [2025-03-13, 06:23:01] ERROR -                                               
 ^^^^^^ chan="stderr" source="task"
   [2025-03-13, 06:23:01] ERROR - NameError: name 'engine' is not defined 
chan="stderr" source="task"
   [2025-03-13, 06:23:01] ERROR - Exception ignored in: <function 
configure_orm.<locals>.<lambda> at 0x7f9a6bddb920> chan="stderr" source="task"
   [2025-03-13, 06:23:01] ERROR - Traceback (most recent call last): 
chan="stderr" source="task"
   [2025-03-13, 06:23:01] ERROR -   File 
"/home/karthikeyan/stuff/python/airflow/airflow/settings.py", line 393, in 
<lambda> chan="stderr" source="task"
   [2025-03-13, 06:23:01] ERROR -     
os.register_at_fork(after_in_child=lambda: 
async_engine.sync_engine.dispose(close=False)) chan="stderr" source="task"
   [2025-03-13, 06:23:01] ERROR -                                               
 ^^^^^^^^^^^^ chan="stderr" source="task"
   ```
   
   ### What you think should happen instead?
   
   _No response_
   
   ### How to reproduce
   
   1. Run `asset_produces_2` dag.
   2. Check the `producing_task_2` task instance log.
   
   ### Operating System
   
   Ubuntu 20.04
   
   ### 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: [email protected]

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

Reply via email to