Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wait_policy option to EmrCreateJobFlowOperator. #44055

Conversation

adrian-adikteev
Copy link
Contributor

@adrian-adikteev adrian-adikteev commented Nov 15, 2024


Currently, when using wait_for_complition=True it will trigger the node to only wait until the cluster is successfully launched.
I added the option wait_policy so that one can chose what waiter will be used.

Possible values:

  • None: No wait (default)
  • WaitPolicy.WAIT_FOR_COMPLETION: Previous behaviour when wait_for_completion was True
  • WaitPolicy.WAIT_FOR_STEPS_COMPLETION: New behaviour - wait for the cluster to terminate.

This is useful because it will eliminate the need to have an extra node in your DAG.

Copy link

boring-cyborg bot commented Nov 15, 2024

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@adrian-adikteev adrian-adikteev force-pushed the emr-job-flow-operator-add-wait-steps-completion branch from 020522f to 3329599 Compare November 15, 2024 12:35
Copy link
Contributor

@vincbeck vincbeck left a comment

Choose a reason for hiding this comment

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

Could you cover this new use case in a unit test?

@adrian-adikteev adrian-adikteev force-pushed the emr-job-flow-operator-add-wait-steps-completion branch from 3329599 to 30c0240 Compare November 18, 2024 08:51
@adrian-adikteev adrian-adikteev changed the title Add wait_for_steps_completion option to EmrCreateJobFlowOperator. Add wait_policy option to EmrCreateJobFlowOperator. Nov 18, 2024
@adrian-adikteev adrian-adikteev force-pushed the emr-job-flow-operator-add-wait-steps-completion branch from 30c0240 to fc111c8 Compare November 18, 2024 09:00
@adrian-adikteev adrian-adikteev force-pushed the emr-job-flow-operator-add-wait-steps-completion branch 4 times, most recently from 5212fa9 to d5f85bc Compare November 18, 2024 15:35
@vincbeck
Copy link
Contributor

Good job! I like that version

@adrian-adikteev adrian-adikteev force-pushed the emr-job-flow-operator-add-wait-steps-completion branch 4 times, most recently from 48c9119 to 68f7950 Compare November 19, 2024 08:36
@adrian-adikteev adrian-adikteev force-pushed the emr-job-flow-operator-add-wait-steps-completion branch 3 times, most recently from 9d81e5e to 25dadd3 Compare November 20, 2024 08:47
@adrian-adikteev adrian-adikteev force-pushed the emr-job-flow-operator-add-wait-steps-completion branch 5 times, most recently from f447927 to 62e4f1e Compare November 21, 2024 08:26
@adrian-adikteev
Copy link
Contributor Author

I'm not sure what's the next step here but from my side everything is ready.

Copy link
Contributor

@vincbeck vincbeck left a comment

Choose a reason for hiding this comment

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

Overall looks good! Just one nit and you do not a newsfragment for this change

docs/apache-airflow-providers-amazon/operators/emr/emr.rst Outdated Show resolved Hide resolved
newsfragments/44055.feature.rst Outdated Show resolved Hide resolved
@adrian-adikteev adrian-adikteev force-pushed the emr-job-flow-operator-add-wait-steps-completion branch 2 times, most recently from b59a5f8 to c425121 Compare November 21, 2024 12:58
Copy link
Contributor

@vincbeck vincbeck left a comment

Choose a reason for hiding this comment

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

Perfect!

@adrian-adikteev adrian-adikteev force-pushed the emr-job-flow-operator-add-wait-steps-completion branch from c425121 to f971512 Compare November 25, 2024 08:59
@adrian-adikteev
Copy link
Contributor Author

adrian-adikteev commented Nov 25, 2024

Should be ready for merge

Possible values:

- None: No wait (default)
- WaitPolicy.WAIT_FOR_COMPLETION: Previous behaviour when wait_for_completion was True
- WaitPolicy.WAIT_FOR_STEPS_COMPLETION: New behaviour - wait for the cluster to terminate.
@adrian-adikteev adrian-adikteev force-pushed the emr-job-flow-operator-add-wait-steps-completion branch from f971512 to de09376 Compare November 25, 2024 09:22
@vincbeck vincbeck merged commit b4c4806 into apache:main Nov 25, 2024
62 checks passed
Copy link

boring-cyborg bot commented Nov 25, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers provider:amazon-aws AWS/Amazon - related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants