You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "dstandish (via GitHub)" <gi...@apache.org> on 2023/09/06 21:44:00 UTC

[GitHub] [airflow] dstandish commented on a diff in pull request #32646: Add task context logging feature to allow forwarding messages to task logs

dstandish commented on code in PR #32646:
URL: https://github.com/apache/airflow/pull/32646#discussion_r1317864670


##########
airflow/models/taskinstance.py:
##########
@@ -895,6 +895,19 @@ def refresh_from_db(self, session: Session = NEW_SESSION, lock_for_update: bool
         else:
             self.state = None
 
+    @classmethod
+    def get_by_key(cls, ti_key, session) -> TaskInstance:
+        return (
+            session.query(TaskInstance)
+            .filter(
+                TaskInstance.task_id == ti_key.task_id,
+                TaskInstance.dag_id == ti_key.dag_id,
+                TaskInstance.run_id == ti_key.run_id,
+                TaskInstance.map_index == ti_key.map_index,
+            )
+            .one_or_none()
+        )

Review Comment:
   What would you propose?  Where should this logic go?  This exists so that `_render_filename` can accept either TI or TI Key.  Would you just inline it in _render_filename?
   
   



-- 
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