You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "lcottereau (via GitHub)" <gi...@apache.org> on 2026/02/18 10:47:25 UTC
[I] LatestOnlyOperator not working if just before a Dynamic Task Mapping [airflow]
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: commits-unsubscribe@airflow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] LatestOnlyOperator not working if just before a Dynamic Task Mapping [airflow]
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal closed issue #62118: LatestOnlyOperator not working if just before a Dynamic Task Mapping
URL: https://github.com/apache/airflow/issues/62118
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] LatestOnlyOperator not working if just before a Dynamic Task Mapping [airflow]
Posted by "tirkarthi (via GitHub)" <gi...@apache.org>.
tirkarthi commented on issue #62118:
URL: https://github.com/apache/airflow/issues/62118#issuecomment-3920607985
It seems when the `LatestOnlyOperator` is a not dynamic then map_index of -1 is passed to downstream tasks. In case of dynamic tasks being dependent on `LatestOnlyOperator` it will try to skip `-1` which will not exist but in case of normal dependent then `-1` will be correct and as it's marked skipped the downstream though dynamic is also marked as skipped.
```
[2026-02-18 17:42:54] INFO - Checking latest only with left_window: 2026-01-03 01:00:00+00:00 right_window: 2026-01-05 01:00:00+00:00 now: 2026-02-18 12:12:54.160606+00:00
[2026-02-18 17:42:54] INFO - Not latest execution, skipping downstream.
[2026-02-18 17:42:54] INFO - Branch into []
[2026-02-18 17:42:54] INFO - Following branch set()
[2026-02-18 17:42:54] INFO - Skipping tasks [('print_label', -1)]
```
https://github.com/apache/airflow/blob/0d3a0349023207c4b42a3a830d4ac233cb334c1f/providers/standard/src/airflow/providers/standard/utils/skipmixin.py#L180-L185
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org