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

Re: [D] ExternalTaskSensor (only for last dag runs) in Airflow 3 [airflow]

GitHub user BioQwer added a comment to the discussion: ExternalTaskSensor (only for last dag runs) in Airflow 3

Hi everyone, I have a similar application and a similar problem.

I have many DAGs that run once a day but at different times.

We also queried the database to find out the start times in order to understand the delta for the External Task Sensor.

This problem is a blocker for us since we have around 100 DAGs with inter-dependencies. Figuring out the delta between each one is a massive undertaking that could introduce many errors.

Now I understand how to get this from the API.

`/api/v2/dags`
i can get diff from `next_dagrun_logical_date`

```
{
  "dags": [
    {
      "dag_id": "test",
      "dag_display_name": "test",
      "is_paused": true,
      "is_stale": false,
      "last_parsed_time": "2026-06-05T05:50:35.210927Z",
      "last_parse_duration": 0.5269125308841467,
      "last_expired": null,
      "bundle_name": "dags-folder",
      "description": "",
      "timetable_summary": "00 21 * * 0",
      "timetable_description": "At 21:00, only on Sunday",
      "timetable_partitioned": false,
      "next_dagrun_logical_date": "2026-05-31T18:00:00Z",
      "next_dagrun_data_interval_start": "2026-05-31T18:00:00Z",
      "next_dagrun_data_interval_end": "2026-05-31T18:00:00Z",
      "next_dagrun_run_after": "2026-05-31T18:00:00Z",
      "allowed_run_types": null,
...
    },
```

But I have absolutely no idea how to obtain a technical client for the requests.

The client needs a token, but if it is running inside the scheduler, it already has all the necessary data, tokens, and other things.
```python
from airflow.sdk.api.client import Client

class Client(httpx.Client):
    def __init__(self, *, base_url: str | None, dry_run: bool = False, token: str, **kwargs: Any):
...
```

It turns out we will be querying the time inside the scheduler.

There is a Local client, but its API is limited.
<img width="761" height="370" alt="image" src="https://github.com/user-attachments/assets/163b0be3-62e6-4be7-a26a-af462fb758f0" />


Can you advise me on how to proceed correctly in this situation? Airflow version 3.2.2.

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

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