lcottereau opened a new issue, #62118:
URL: https://github.com/apache/airflow/issues/62118

   ### Apache Airflow version
   
   Other Airflow 3 version (please specify below)
   
   ### If "Other Airflow 3 version" selected, which one?
   
   3.1.5
   
   ### What happened?
   
   When backfilling a DAG with `LatestOnlyOperator`, I realised the tasks after 
the LatestOnlyOperator were still executing.
   
   I _think_ it used to work before (probably in 2.*) but can't confirm that 
anymore.
   
   ### What you think should happen instead?
   
   When backfilling (before the current schedule), the tasks following the 
`LatestOnlyOperator` should be skipped, as per the purpose of this operator.
   
   ### How to reproduce
   
   The following stripped-down code reproduces the problem in my environment, 
when I backfill a few days before the current day:
   - for the `test_bug_OK` DAG, `intermediate_step` and `print_all` tasks are 
skipped
   - for the `test_bug_OK` DAG, `print_all` tasks still execute
   
   ```python
   from airflow.providers.standard.operators.latest_only import 
LatestOnlyOperator
   from airflow.sdk import DAG, task
   from pendulum import datetime
   
   with DAG(
       dag_id="test_bug_KO",
       schedule="0 1 * * *",
       start_date=datetime(2026, 1, 1),
       catchup=False,
   ):
       is_latest = LatestOnlyOperator(task_id="is_latest")
   
       @task
       def print_label(label: str):
           print(label)
   
       print_all = print_label.expand(label=["Label 0", "Label 1"])
   
       is_latest >> print_all
   
   
   with DAG(
       dag_id="test_bug_OK",
       schedule="0 1 * * *",
       start_date=datetime(2026, 1, 1),
       catchup=False,
   ):
       is_latest = LatestOnlyOperator(task_id="is_latest")
   
       @task
       def print_label(label: str):
           print(label)
   
   
       intermediate_step = print_label("Before")
   
       print_all = print_label.expand(label=["Label 0", "Label 1"])
   
       is_latest >> intermediate_step >> print_all
   ```
   
   ### Operating System
   
   Debian 13.3
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-amazon==9.18.0
   apache-airflow-providers-common-compat==1.10.0
   apache-airflow-providers-common-io==1.7.0
   apache-airflow-providers-common-sql==1.30.0
   apache-airflow-providers-fab==3.0.1
   apache-airflow-providers-http==5.6.0
   apache-airflow-providers-postgres==6.5.0
   apache-airflow-providers-samba==4.12.0
   apache-airflow-providers-smtp==2.4.0
   apache-airflow-providers-ssh==4.1.5
   apache-airflow-providers-standard==1.10.0
   
   ### Deployment
   
   Virtualenv installation
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   The problem recurs every time
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to