Skip to content

EmrCreateJobFlowOperator returns early when wait_for_completion=True #45651

Description

@enewnham

Apache Airflow version

2.10.4

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

No response

What happened?

The EmrCreateJobFlowOperator returns early when wait_for_completion=True due improperly treating Running as success in the acceptor. When a step is running that doesn't necessarily mean the job is complete, only waiting for new jobs or terminated should the cluster be considered idle and the job completed.

This was introduced in #37667, https://github.com/apache/airflow/pull/37667/files#diff-f4ade57b13bf58042c4171d225b9b28c7610072f8b33b722bb138db900feb7fcR65-R70

I added some printf debugging to find this issue

[2025-01-14, 17:22:34 UTC] {emr.py:706} INFO - Job flow with id j-YEXH6CUHAEDF created
[2025-01-14, 17:22:34 UTC] {emr.py:737} INFO - job_flow_waiting
[2025-01-14, 17:22:34 UTC] {waiter.py:394} INFO - here: wait
[2025-01-14, 17:23:34 UTC] {waiter.py:394} INFO - here: wait
[2025-01-14, 17:24:35 UTC] {waiter.py:394} INFO - here: wait
[2025-01-14, 17:25:35 UTC] {waiter.py:369} INFO - here: current_state=success

Image

What you think should happen instead?

The EmrCreateJobFlowOperator should continue to wait_for_completion while there are steps still running in the EMR cluster

How to reproduce

Use the EmrCreateJobFlowOperator to create a cluster with one or more steps. Optionally set "KeepJobFlowAliveWhenNoSteps": False,

Operating System

Amazon Linux

Versions of Apache Airflow Providers

No response

Deployment

Amazon (AWS) MWAA

Deployment details

No response

Anything else?

Every time

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corekind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yetprovider:amazonAWS/Amazon - related issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions