uranusjr commented on a change in pull request #18724:
URL: https://github.com/apache/airflow/pull/18724#discussion_r780875292



##########
File path: airflow/models/taskinstance.py
##########
@@ -722,6 +722,32 @@ def error(self, session=NEW_SESSION):
         session.merge(self)
         session.commit()
 
+    @classmethod
+    @provide_session
+    def find(
+        cls,
+        task_id: str,
+        dag_id: str,
+        execution_date: Optional[datetime] = None,
+        run_id: Optional[str] = None,
+        session: Session = NEW_SESSION,
+    ) -> bool:
+        """Returns a TaskInstance for the given criteria or none."""

Review comment:
       ```suggestion
           """Find a TaskInstance for the given criteria.
   
           Paramters ``dag_id`` and ``task_id`` are required. Exactly one of 
``run_id`` and
           ``execution_date`` is required to find the DAG run that owns the 
task instance.
           """
   ```
   
   But can we _not_ support `execution_date` here? A long-term goal of AIP-39 
is to remove `DagRun.execution_date`’s uniqueness requirement (so two runs can 
have the same logical date as long as they have different run IDs), and I’m 
hesitant to add new APIs that rely on this unique constraint.

##########
File path: airflow/models/taskinstance.py
##########
@@ -722,6 +722,32 @@ def error(self, session=NEW_SESSION):
         session.merge(self)
         session.commit()
 
+    @classmethod
+    @provide_session
+    def find(
+        cls,
+        task_id: str,
+        dag_id: str,
+        execution_date: Optional[datetime] = None,
+        run_id: Optional[str] = None,
+        session: Session = NEW_SESSION,

Review comment:
       ```suggestion
           *,
           session: Session = NEW_SESSION,
   ```




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