ephraimbuddy commented on code in PR #39951:
URL: https://github.com/apache/airflow/pull/39951#discussion_r1631328804


##########
airflow/models/taskinstance.py:
##########
@@ -553,6 +553,26 @@ def clear_task_instances(
     session.flush()
 
 
+def record_task_instance_history(ti, session):
+    """Update the task instance history table."""
+    if ti.state not in [

Review Comment:
   Yeah. I was avoiding using session.merge and rewriting history. I changed 
this to a query to check if the object exist before inserting. That way, we 
won't have integrity error because repeatedly clearing some states would cause 
integrity error since the try_number won't have changed



##########
airflow/models/taskinstance.py:
##########
@@ -553,6 +553,26 @@ def clear_task_instances(
     session.flush()
 
 
+def record_task_instance_history(ti, session):
+    """Update the task instance history table."""
+    if ti.state not in [

Review Comment:
   Yeah. I was avoiding using session.merge and rewriting history. I changed 
this to a query to check if the object exists before inserting. That way, we 
won't have integrity error because repeatedly clearing some states would cause 
integrity error since the try_number won't have changed



-- 
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-unsubscr...@airflow.apache.org

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

Reply via email to