Skip to content

DAGs with future start_date are automatically marked as success without executing tasks #38513

Open

Description

@eladkal

Body

For the following DAG:

from datetime import datetime

from airflow import DAG
from airflow.operators.bash import BashOperator

default_args = {
    'owner': 'airflow',
}

with DAG('my_future_dag',
         default_args=default_args,
         start_date=datetime(2050, 1, 1),
         schedule="@daily",
         catchup=False
         ):
    BashOperator(task_id="task1", bash_command="echo 1")
    BashOperator(task_id="task2", bash_command="echo 2")
    BashOperator(task_id="task3", bash_command="echo 3")
    BashOperator(task_id="task4", bash_command="echo 4")

As expected no runs will be started till 2050 but I might still want to manually invoke runs. Trying to do so will result in DAGRun marked as success and no tasks being executed as can see

Screenshot 2024-03-26 at 22 22 42

However changing the start_date to datetime(2023, 1, 1) then tasks are executed as expected for manual runs:
Screenshot 2024-03-26 at 22 24 28

The bug:
tasks should be executed for manual runs. The current case where dagrun is marked as success but no tasks are running or reporting failure is wrong.

By the way, a very interesting thing to explore is that if you first deploy the dag with datetime(2023, 1, 1) then change it to datetime(2050, 1, 1) Airflow has no problem with running tasks with that start_date:

Screenshot 2024-03-26 at 22 28 19

Screenshot 2024-03-26 at 22 29 36

Committer

  • I acknowledge that I am a maintainer/committer of the Apache Airflow project.

Activity

  1. added
    kind:bug
    affected_version:main_branch
    on Mar 26, 2024
  2. tirkarthi commented on Mar 27, 2024

    @tirkarthi
    Contributor

    https://forum.astronomer.io/t/dag-run-marked-as-success-but-no-tasks-even-started/1423
    https://stackoverflow.com/q/73652663

    We usually have users using dynamic start_date which causes the issue. We point them to these links. It will be helpful if these dagruns are blocked from marked as success.

  3. eladkal commented on Mar 27, 2024

    @eladkal
    ContributorAuthor

    Dynamic start date is wrong usage. The case that I show here is valid.

  4. amoghrajesh commented on Mar 28, 2024

    @amoghrajesh
    Contributor

    @eladkal I want to try my hand at this one, seems interesting. Can I take it up?

  5. eladkal commented on Mar 28, 2024

    @eladkal
    ContributorAuthor

    Sure. Assigned @amoghrajesh

  6. artilexx commented on Jul 7, 2024

    @artilexx
    Contributor

    @amoghrajesh have you been able to figure out what is causing this?

  7. artilexx commented on Jul 7, 2024

    @artilexx
    Contributor

    regarding the note about the tasks running if you deploy the dag with a past start_date and change it to a future start_date, it will run the tasks properly for a while but then revert to the old behaviour after manually triggering the dag a few times

    side note: same issue behaviour when manual run is triggered after end_date

  8. adamliter commented on Dec 3, 2024

    @adamliter

    This is the same for manually-triggered DAG runs with a logical date that is before the start_date. I would expect/hope that manually triggered runs with a logical date prior to the start_date of the DAG would actually run. However, they do not (i.e., none of the tasks run; instead, the DAG run is just marked as an immediate success).

    I have a use case for this where I have a DAG that schedules a compute-intensive Spark job on an EMR cluster. Because of the nature of the upstream dataset (there is late-arriving data), the Spark job processes data with a 7-day lookback window from each data_interval_start. The job runs twice daily. As a result, some of the same data is reprocessed. I set the start date to 2024-12-01. But I would like to backfill data from 2024-10-01 to 2024-12-01.

    I don't want to set the start_date to 2024-10-01 with catchup=True because the late-arriving data has already arrived for the historical months. In other words, I don't want to have ≈120 DAG runs get scheduled for the preceding two months. Instead, I'd like to just run some manual DAG runs: 2024-10-07, 2024-10-14, 2024-10-21, 2024-10-28, etc.. Since the late-arriving data has already arrived for these historical months, I don't want to have several overlapping runs with a sliding lookback window. Instead, I just want to trigger several manual runs each of which is spaced 7 days apart for the historical months.

    I see that @artilexx had done some initial work to address this in #40711 but it was closed due to inactivity.

    Is there still interest in merging this? If so, happy to take a shot at it when I can find time and also try to make it work for my use case with manually-triggered DAG runs with a logical date prior to the start_date. (But also don't want to step on @artilexx's toes if they want to pick it back up.)

  9. artilexx commented on Dec 3, 2024

    @artilexx
    Contributor

    @adamliter feel free to pick it up. The changes I made definitely fixed the problem with DAGs not running when I tested it out, but it also broke the UI (iirc) and I was never able to figure out why.

  10. removed
    affected_version:main_branch
    on Aug 28, 2025
  11. github-actions commented on Sep 14, 2026

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has been open for 365 days without any activity. There has been several Airflow releases since last activity on this issue. Kindly asking to recheck the report against latest Airflow version and let us know if the issue is reproducible. The issue will be closed in next 30 days if no further activity occurs from the issue author.

  12. yuseok89 commented on Oct 12, 2026

    @yuseok89
    Contributor

    This still happens on main for manual runs whose logical date is before the task's start_date, as noted above. #74387 makes task start_date and end_date only limit scheduled runs, so manual and other non-scheduled runs create and run their task instances.

  13. added
    needs-triage
    and removed on Oct 13, 2026
  14. removed
    needs-triage
    on Oct 18, 2026
  15. uranusjr commented on Oct 19, 2026

    @uranusjr
    Member

    I’m not entirely convinced it’s a good idea to blanket-ignore those values for manual runs. It is plausible that some users currently use start_date to gate tasks from being run until a future date, which is what the argument is originally intend for. This change would be breaking for those users.

    Maybe it would make sense to add a flag on dag run triggering to optionally ignore task-level start/end dates, but that’d be a noticeably larger change.

  16. ashb commented on Oct 19, 2026

    @ashb
    Member

    I’m not entirely convinced it’s a good idea to blanket-ignore those values for manual runs. It is plausible that some users currently use start_date to gate tasks from being run until a future date, which is what the argument is originally intend for. This change would be breaking for those users.

    Agreed, at this point, changing this behaviour is a breaking change. this is what i have used it for - adding a new node to a graph that MUST not run before a specific date.

    Maybe it would make sense to add a flag on dag run triggering to optionally ignore task-level start/end dates, but that’d be a noticeably larger change.

    I'm honestly not sure this needs changing now that it seems backfill already covers this use case?

  17. ashb commented on Oct 19, 2026

    @ashb
    Member

    This is the same for manually-triggered DAG runs with a logical date that is before the start_date. I would expect/hope that manually triggered runs with a logical date prior to the start_date of the DAG would actually run

    As a datapoint: And I have relied on the opposite, so any change, or leaving it is going to be against someones expectations

  18. yuseok89 commented on Oct 19, 2026

    @yuseok89
    Contributor

    Thanks both for the context. Since this issue was opened, backfill can be run from the UI and the API in Airflow 3, and backfill runs already skip the task date window. Given that, ignoring task start_date and end_date for manual runs might be too broad a change at this point.

    That said, I do think the empty run itself can still confuse users, since it shows as success although nothing has run. How about showing a warning in the trigger form when the chosen logical date is outside the Dag's start_date and end_date, saying that no task will run? It would keep the current behaviour for those who rely on it, and only make the empty run visible to those who don't expect it.

  19. yuseok89 commented on Oct 19, 2026

    @yuseok89
    Contributor

    Maybe it would make sense to add a flag on dag run triggering to optionally ignore task-level start/end dates, but that’d be a noticeably larger change.

    As for an opt-in flag to ignore the dates when triggering, it is a larger change as mentioned above, so how about adding it later if there turns out to be demand for it?

  20. yuseok89 commented on Oct 20, 2026

    @yuseok89
    Contributor

    I opened #75223 to show how the warning in the trigger form would look, with screenshots. It only adds the warning and keeps the current behaviour. Please feel free to review it, or to close it if this isn't the direction you'd like to go.

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

Metadata

Metadata

Assignees

Labels

area:corearea:schedulerkind:bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions