The GitHub Actions job "Tests" on airflow.git has failed.
Run started by GitHub user kaxil (triggered by kaxil).

Head commit for run:
395ad7110e53a30a5d33f648d1dd797482eb268c / Kaxil Naik <[email protected]>
Listener: Set task on sqlalchemy taskinstance object (#27167)

same as https://github.com/apache/airflow/pull/21157

TaskListener API's contract promises to pass TaskInstance object to listener 
plugin. However, what happens is not 100% true - the object being passed is one 
that maps to current SQLAlchemy session.

`_run_raw_task` before merging the TI operates on detached TaskInstance object, 
then merges it to current session. Since there is no attached object in the 
SQLAlchemy identity map, SQLAlchemy creates it, and it's this object that's 
being passed to the SQLAlchemy event listeners.

The problem with that is that when creating new SQLAlchemy object, SQLAlchemy 
takes care about setting only database-mapped fields. The ones that are purely 
on the python side, like task aren't being set on the new object.

This PR manually sets `task` on the new SQLAlchemy object, so that 
`on_task_instance_success` receives proper TaskInstance with task field set.

Report URL: https://github.com/apache/airflow/actions/runs/3292667388

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to