Skip to content

Conversation

@laksh-krishna-sharma
Copy link
Contributor

Summary of Changes

This PR fixes the behavior of EmrCreateJobFlowOperator when global deferrable mode is enabled (AIRFLOW__OPERATORS__DEFAULT_DEFERRABLE=true).

Previously, the operator would defer unconditionally if deferrable=True, even when no wait policy was requested. This caused submit-only jobs (e.g., wait_policy=None) to unexpectedly defer. With this fix, the operator now only defers when a wait policy is explicitly provided.

Closes #40966


Changes Made

  • Updated EmrCreateJobFlowOperator logic:

    • Deferral now occurs only when wait_policy is set and deferrable=True.
    • Synchronous waiting occurs when wait_policy is set and deferrable=False.
    • No waiting or deferral happens when wait_policy=None (submit-only mode).
  • Adjusted tests to cover all scenarios:

    • No wait policy + deferrable → submit-only (no defer).
    • No wait policy + non-deferrable → submit-only (no waiter).
    • Wait policy + deferrable → deferred (raises TaskDeferred).
    • Wait policy + non-deferrable → synchronous wait with get_waiter().wait.

@laksh-krishna-sharma
Copy link
Contributor Author

@eladkal and @o-nikolas Please review the changes, and let me know if further adjustments are needed.

@eladkal eladkal requested a review from vincbeck September 25, 2025 12:06
@vincbeck
Copy link
Contributor

If you want this PR to be merged, please stop rebasing it. We need the CI to finish before merging it. And every-time, you update this PR, all tests are restarting. If you actually make some changes to this PR, then ignore this message :)

@vincbeck
Copy link
Contributor

Static checks are failing, can you please fix them? You can find more information about static checks here: https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst

@laksh-krishna-sharma
Copy link
Contributor Author

sure i will check and fix failing test

Copy link
Contributor

@o-nikolas o-nikolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code changes look fine (other than the static check failures).

But I don't love the non-standard wait configuration that this operators uses. Emr is the only one that uses wait_policy. This fix is okay for now, but I'd be in favour of dropping wait_policy altogether (with a deprecation of course), unless someone knows of a good reason it was added in the first place?

@vincbeck
Copy link
Contributor

I agree with Niko, somehow this operator does not follow the standard in Amazon provider package. I created an issue to track that: #56153. In the meantime, merging this PR.

@vincbeck vincbeck merged commit b740827 into apache:main Sep 26, 2025
80 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Sep 26, 2025

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

@laksh-krishna-sharma
Copy link
Contributor Author

Thank you @vincbeck @o-nikolas for reviewing and merging this PR! This was my first contribution to Apache Airflow, and I really appreciate the guidance and feedback from the maintainers and community. Excited to keep learning and contributing more!

@laksh-krishna-sharma laksh-krishna-sharma deleted the fix/emr-operator-deferral-logic branch September 26, 2025 20:25
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Sep 30, 2025
…he#56077)

* fixing emr operator deferral logic

* fixed failing test ruff lint
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 1, 2025
…he#56077)

* fixing emr operator deferral logic

* fixed failing test ruff lint
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 2, 2025
…he#56077)

* fixing emr operator deferral logic

* fixed failing test ruff lint
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 3, 2025
…he#56077)

* fixing emr operator deferral logic

* fixed failing test ruff lint
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 4, 2025
…he#56077)

* fixing emr operator deferral logic

* fixed failing test ruff lint
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 5, 2025
…he#56077)

* fixing emr operator deferral logic

* fixed failing test ruff lint
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 5, 2025
…he#56077)

* fixing emr operator deferral logic

* fixed failing test ruff lint
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 7, 2025
…he#56077)

* fixing emr operator deferral logic

* fixed failing test ruff lint
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 8, 2025
…he#56077)

* fixing emr operator deferral logic

* fixed failing test ruff lint
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 9, 2025
…he#56077)

* fixing emr operator deferral logic

* fixed failing test ruff lint
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 10, 2025
…he#56077)

* fixing emr operator deferral logic

* fixed failing test ruff lint
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 11, 2025
…he#56077)

* fixing emr operator deferral logic

* fixed failing test ruff lint
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 12, 2025
…he#56077)

* fixing emr operator deferral logic

* fixed failing test ruff lint
dabla pushed a commit to dabla/airflow that referenced this pull request Oct 12, 2025
…he#56077)

* fixing emr operator deferral logic

* fixed failing test ruff lint
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 14, 2025
…he#56077)

* fixing emr operator deferral logic

* fixed failing test ruff lint
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 15, 2025
…he#56077)

* fixing emr operator deferral logic

* fixed failing test ruff lint
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 17, 2025
…he#56077)

* fixing emr operator deferral logic

* fixed failing test ruff lint
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 19, 2025
…he#56077)

* fixing emr operator deferral logic

* fixed failing test ruff lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EmrCreateJobFlowOperator should not wait_for_completion if wait_for_completion=false deferrable=true

3 participants