dstandish commented on code in PR #42928:
URL: https://github.com/apache/airflow/pull/42928#discussion_r1797717301
##########
airflow/models/taskinstance.py:
##########
@@ -1632,11 +1632,12 @@ def _get_previous_ti(
@internal_api_call
@provide_session
-def _update_rtif(ti, rendered_fields, session: Session | None = None):
+def _update_rtif(ti, rendered_fields, session: Session = NEW_SESSION):
from airflow.models.renderedtifields import RenderedTaskInstanceFields
rtif = RenderedTaskInstanceFields(ti=ti, render_templates=False,
rendered_fields=rendered_fields)
RenderedTaskInstanceFields.write(rtif, session=session)
+ session.commit()
Review Comment:
ok so i think i understand what's going on
RTIF pk is same as TI
So RTIF to TI is 1-1
but there is logic to keep only the "latetst" N RTIF records, controlled by
`max_num_rendered_ti_fields_per_task`
so if we're already at the limit of RTIF records, and we add one more, it
will always be deleted.
alternatively we could run the delete code first and _then_ write. that
would probably make more sense.
--
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]