GitHub user ajbosco edited a comment on the discussion: ExternalTaskSensor 
(only for last dag runs) in Airflow 3

As far as I can tell, the API does not expose the ability to do something like 
this:

```
 if self.lookback_date == "run_date":
            count = (
                session.query(TI)
                .filter(
                    TI.dag_id == self.external_dag_id,
                    TI.task_id == self.external_task_id,
                    TI.state.in_(self.allowed_states),
                    TI.start_date >= start_dttm,
                    TI.start_date <= end_dttm,
                )
                .count()
            )
        else:
            count = (
                session.query(TI)
                .filter(
                    TI.dag_id == self.external_dag_id,
                    TI.task_id == self.external_task_id,
                    TI.state.in_(self.allowed_states),
                    TI.logical_date >= start_dttm,
                    TI.logical_date <= end_dttm,
                )
                .count()
            )


GitHub link: 
https://github.com/apache/airflow/discussions/49997#discussioncomment-14036535

----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscr...@airflow.apache.org

Reply via email to