raviagarwalunravel commented on a change in pull request #5118: [AIRFLOW-4315] 
Add monitoring API's to airflow
URL: https://github.com/apache/airflow/pull/5118#discussion_r280671127
 
 

 ##########
 File path: airflow/models/taskinstance.py
 ##########
 @@ -215,6 +215,49 @@ def try_number(self, value):
     def next_try_number(self):
         return self._try_number + 1
 
+    @staticmethod
+    @provide_session
+    def find(session=None, dag_id=None, task_id=None, execution_date=None,
+             execution_date_before=None, execution_date_after=None,
+             state=None, state_not_equal=None):
+        """
+        Returns a set of dag runs for the given search criteria.
+
+        :param dag_id: the dag_id to find task instance for
+        :type dag_id: int
+        :param task_id: the task_id to find task instance for
+        :type task_id: int
+        :param execution_date_before: filter on execution date before the 
provided one
+        :type execution_date_before: datetime.datetime
+        :param execution_date_after: filter on execution date after the 
provided one
+        :type execution_date_after: datetime.datetime
+        :param state_not_equal: the state of the task instance not to be in 
the results
+        :type state: airflow.utils.state.State
+        :param state: the state of the task instance
+        :type state: airflow.utils.state.State
+        :param session: database session
+        :type session: sqlalchemy.orm.session.Session
+        """
+        TI = TaskInstance
+
+        query = session.query(TI)
+        if dag_id:
 
 Review comment:
   I guess not, what if the user is simply interested in all the data?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to