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

   ### Apache Airflow version
   
   Other Airflow 2 version (please specify below)
   
   ### What happened
   
   This was on 2.4.3. I have not yet had a chance to try on 2.5.x or 2.6. Will 
report further when I get a chance.
   
   We were seeing a weird issue with one of our DAGs. The pattern was a series 
of tasks using `.expand()` one after the other. A set of IDs were being passed 
along the chain. Some of the tasks had the effect of filtering down that set of 
IDs. If the set of IDs wound up empty, as you'd imagine the subsequent tasks 
would be skipped.
   
   Occasionally what we'd see was  when that happened the DAG would be marked 
as a failure. At some point instead of `skipped` the tasks are marked as `not 
yet started`, and no task had been marked as failed. 
   
   ### What you think should happen instead
   
   I'd expect to not have a DAG marked as a failure if there was no obvious 
failure
   
   ### How to reproduce
   
   I've managed to replicate the behavior I saw. That said the only way I found 
that I could reliably use to toggle the behavior isn't what we were doing so I 
might have stumbled on "same issue, different cause".
   
   Example DAG code:
   
   ```
   @dag(
       dag_id="test",
       schedule=None,
       catchup=False,
       start_date=datetime(2022, 1, 1),
   )
   def test():
       @task
       def generate_some_data():
           # return [1, 2, 3, 4, 5]
           return []
   
       @task
       def plus_one(datum):
           return datum + 1
   
       some_data = generate_some_data()
       #some_data = []
   
       foo = plus_one.expand(datum=some_data)
       bar = plus_one.override(task_id="bar").expand(datum=foo)
       baz = plus_one.override(task_id="baz").expand(datum=bar)
       qux = plus_one.override(task_id="quz").expand(datum=baz)
   ```
   
   Run as is, it works as I'd expect, and the DAG succeeds w/ all but the first 
task being skipped
   However, if I swap out the some_data assignment, I get this behavior. The 
first 2 tasks are skipped, the 2nd two are not yet started, and the DAG fails.
   With this specific example I could see why the 2nd DAG is marked as failed - 
my assumption is no task succeeded. But I don't understand why it fails the way 
it does. Why does it choose that point to start the not yet started behavior?
   In the real DAG it exhibits this behavior with successful tasks earlier on 
so even my handwavy mental explanation above doesn't track.
   
   ![Screenshot 2023-04-12 at 8 39 37 AM 5 17 37 
PM](https://github.com/apache/airflow/assets/961771/de46e6ec-2a9f-4dbe-9bad-bde3aad2dc3c)
   ![Screenshot 2023-04-12 at 8 40 37 AM 5 17 37 
PM](https://github.com/apache/airflow/assets/961771/4a3f1356-1a4c-46c7-9f89-70b6887b406d)
   
   
   ### Operating System
   
   This is using docker container `apache/airflow:2.4.3-python3.10`
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-common-sql==1.2.0
   apache-airflow-providers-ftp==3.1.0
   apache-airflow-providers-google==8.4.0
   apache-airflow-providers-http==4.0.0
   apache-airflow-providers-imap==3.0.0
   apache-airflow-providers-postgres==5.2.2
   apache-airflow-providers-sendgrid==3.0.0
   apache-airflow-providers-slack==6.0.0
   apache-airflow-providers-sqlite==3.2.1
   
   ### Deployment
   
   Other 3rd-party Helm chart
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   It seemed tied to something specific about our DAG code, but we couldn't 
identify anything that was causing it. We could artificially change order of 
tasks & things like that and the problem would go away. But any configuration 
that was actually valid for what we were trying to do would trigger this.
   
   Eventually for this and other reasons we changed the whole approach and thus 
the problem went away.
   
   ### Are you willing to submit PR?
   
   - [X] 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