You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ramwin (via GitHub)" <gi...@apache.org> on 2024/01/18 07:19:14 UTC
[I] depends_on_past not working [airflow]
ramwin opened a new issue, #36857:
URL: https://github.com/apache/airflow/issues/36857
### Apache Airflow version
Other Airflow 2 version (please specify below)
### If "Other Airflow 2 version" selected, which one?
2.7.3
### What happened?
I wrote dag like this
```
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime
from pathlib import Path
import pendulum
import random
from airflow import DAG
from airflow.decorators import task
from airflow.operators.bash import BashOperator
@task
def random_fail(ti=None):
if random.random() > 0.5:
raise ValueError("error")
with DAG(
"test_error_true",
start_date=pendulum.now()-datetime.timedelta(minutes=5),
tags=["test"],
max_active_runs=1,
schedule_interval="* * * * *",
) as dag:
bash1 = BashOperator(
task_id="task1",
bash_command=r"date +%Y-%m-%d\ %H:%M:%S",
depends_on_past=True,
)
bash2 = BashOperator(
task_id="task2",
bash_command=r"date +%Y-%m-%d\ %H:%M:%S",
depends_on_past=True,
)
bash3 = BashOperator(
task_id="task3",
bash_command=r"date +%Y-%m-%d\ %H:%M:%S",
depends_on_past=True,
)
bash1 >> random_fail() >> bash2 >> bash3
```
But even previous task fails, this dag will continue run in the next duration.
### What you think should happen instead?
duriong the next dag run, the task will stuck at `random_fail` task since the previous task fails
### How to reproduce
copy this dag file to airflow project
### Operating System
PRETTY_NAME="Ubuntu 22.04.3 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04.3 LTS (Jammy Jellyfish)" VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=jammy
### Versions of Apache Airflow Providers
apache-airflow-providers-common-sql==1.7.2
apache-airflow-providers-ftp==3.5.2
apache-airflow-providers-http==4.5.2
apache-airflow-providers-imap==3.3.2
apache-airflow-providers-sqlite==3.4.3
apache-airflow-providers-ssh==3.7.3
### 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
- [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] depends_on_past not working [airflow]
Posted by "RNHTTR (via GitHub)" <gi...@apache.org>.
RNHTTR closed issue #36857: depends_on_past not working
URL: https://github.com/apache/airflow/issues/36857
--
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] depends_on_past not working [airflow]
Posted by "RNHTTR (via GitHub)" <gi...@apache.org>.
RNHTTR commented on issue #36857:
URL: https://github.com/apache/airflow/issues/36857#issuecomment-1899365806
The `random_fail` task doesn't have `depends_on_past=True`, so new DAG runs are able to continue.
If you update the `random_fail` task as follows, it will work as expected:
```
@task(depends_on_past=True)
def random_fail():
if random.random() > 0.1:
raise ValueError("error")
```
<img width="122" alt="image" src="https://github.com/apache/airflow/assets/25823361/08ab736b-ba58-41b7-be3f-edddbbb24d3f">
<img width="1076" alt="image" src="https://github.com/apache/airflow/assets/25823361/4b9ab7a9-bf6b-4836-bd61-9b437221cae8">
[depends_on_past docs](https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/dags.html#depends-on-past) works for the task instance of the same task in the previously scheduled DAG run.
--
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