Skip to content

Continuous timetable causes false dag triggering if dag has already run and start_date is in future #45081

@darkag

Description

@darkag

Apache Airflow version

2.10.4

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

No response

What happened?

hello,
here is a sample dag

import pendulum 
import airflow
import logging
from airflow import DAG
from datetime import timedelta, datetime
from airflow.utils.dates import days_ago
from airflow.operators.python import PythonOperator
from airflow.decorators import task

local_tz = pendulum.timezone("Europe/Paris")

default_args = {
	'owner': 'interfaces',
	'depends_on_past': False,
	'retries': 0,
	'retry_delay': timedelta(minutes=1),
}
with DAG(
	dag_id='test_continous',
	default_args=default_args,
	schedule='@continuous',
	start_date=datetime(2024,12,19, 16, 40, tzinfo=local_tz),
    end_date= datetime(2024,12,19, 16, 46, tzinfo=local_tz),
	max_active_runs=1,
	catchup=False,
) as dag:
    
    @task()
    def the_task():
        import time
        time.sleep(25)

    the_task()

the first time you activate it, it will correctly wait for start_date to trigger dag run but if it has already run, every seconds it will trigger a "void" dag run (no task started just a row inserted in the dag_run table)

What you think should happen instead?

Dag shouldn't be triggered until the new start_date is passed

How to reproduce

use the given dag, change start_date and end_date in order to let dag runs for a few minutes. when end_date is passed change start_date and end_date in order to make dag runs in future.

Operating System

debian 11

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions