Skip to content

Inconsistent data_interval_start/data_interval_end behavior between manual and scheduled DAG runs #41014

Closed as not planned

Description

@ajsquared

Apache Airflow version

Other Airflow 2 version (please specify below)

If "Other Airflow 2 version" selected, which one?

2.8.3

What happened?

I have a DAG with a schedule of "20 */3 * * *" and catchup=False.

This DAG was paused temporarily, such that we had the scheduled__2024-07-24T03:20:00+00:00 and scheduled__2024-07-24T09:20:00+00:00 runs, but the run in between was skipped.

We later wanted to manually trigger the missed DAG run. We used 2024-07-24 06:20:00+00 as the logical date in the DAG run trigger form, but this resulted in

Data interval start | 2024-07-24, 03:20:00 UTC
Data interval end | 2024-07-24, 06:20:00 UTC

This is the same interval as the scheduled__2024-07-24T03:20:00+00:00 run. The scheduled__2024-07-24T09:20:00+00:00 had

Data interval start | 2024-07-24, 09:20:00 UTC
Data interval end | 2024-07-24, 12:20:00 UTC

This indicates an inconsistency in the treatment of the logical date between manual and scheduled runs. For a scheduled run, the logical date is the data interval start date, but for manual DAG runs it is the data interval end date.

We were unable to trigger the DAG run with a logical date of 2024-07-24 09:20:00+00, which failed with The logical date 2024-07-24 09:20:00+00:00 already exists.

We ended up doing a manual backfill instead since we couldn't trigger a DAG run with the appropriate data interval.

What you think should happen instead?

Both manual and scheduled runs should treat the logical date the same way. I have no preference on whether it is the data interval start or end date as long as they're consistent.

How to reproduce

  1. Create a DAG with a schedule of "20 */3 * * *" and catchup=False
  2. Let one DAG run complete
  3. Pause the DAG until after the next DAG run would have started
  4. Unpause the DAG run
  5. Let the next DAG run complete
  6. Attempt to manually trigger the skipped DAG run

Operating System

Debian GNU/Linux 12 (bookworm)

Versions of Apache Airflow Providers

No response

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    kind:bug
    needs-triage
    on Jul 24, 2024
  2. boring-cyborg commented on Jul 24, 2024

    @boring-cyborg

    Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

  3. changed the title [-]Inconsistent data_interval_start/data_interval_end behavior between maual and scheduled DAG runs[/-] [+]Inconsistent data_interval_start/data_interval_end behavior between manual and scheduled DAG runs[/+] on Jul 24, 2024
  4. removed
    needs-triage
    on Jul 26, 2024
  5. uranusjr commented on Jul 31, 2024

    @uranusjr
    Member

    The behaviour is expected and (unfortunately) intended. When a run is scheduled, it is identified by its data interval, but a manually triggered run does not have a pre-defined interval to start with, so it is instead identified by the time it’s triggered (or the custom date you provide), and the data interval calculated from it. Notably, the data interval is calculated backwards because a run cannot start before the interval it covers ends, and calculating forward would force a trigger to wait for potentially a long time before it can actually kick start anything, which is not people want. This has been the behaviour since pre-historic times (in the sense that nobody really remembers who created it and why), and we couldn’t change it due to compatibility issues.

    But you’ve come at the right time! Airflow 3 is set to start development next month, and it will be possible to break compatibility in a major version bump. I think there’s already an issue somewhere for this, or I’m going to create one if I can’t find it.

  6. self-assigned this
    on Jul 31, 2024
  7. added this to the Airflow 3.0.0 milestone on Jul 31, 2024
  8. added
    airflow3.0:candidate
    on Jul 31, 2024
  9. eladkal commented on Mar 14, 2025

    @eladkal
    Contributor

    @uranusjr is this one still planned for Airflow 3?

  10. uranusjr commented on Mar 14, 2025

    @uranusjr
    Member

    I think we can close this. The new “trigger” timetables fix this (and are the default for new Airflow deployments). We’re not going to change the old timetables since it would break to many existing workflows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

airflow3.0:candidatearea:corearea:schedulerkind:bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions