Skip to content

Conversation

@victorphoenix3
Copy link
Contributor

@victorphoenix3 victorphoenix3 commented Feb 8, 2022

Query status polling logic currently polls until the query is not in intermmediate state. It should instead poll until query is not in the terminal state.
Resolves #19877

@boring-cyborg boring-cyborg bot added area:providers provider:amazon AWS/Amazon - related issues labels Feb 8, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Feb 8, 2022

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 Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
Here are some useful points:

  • Pay attention to the quality of your code (flake8, 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.
    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

@victorphoenix3 victorphoenix3 changed the title query status polling logic #19877 query status polling logic Feb 8, 2022
@victorphoenix3 victorphoenix3 changed the title query status polling logic Refactor query status polling logic in EMRContainerHook Feb 8, 2022
Copy link
Contributor

Choose a reason for hiding this comment

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

Is "CANCEL_PENDING" really a terminal state?

Looks good to me other than this question.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"CANCEL_PENDING" is being treated as a failure state for the EMR container sensor, which is why I included it as a terminal state. Should it be removed?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know the EMR behavior well enough to say. If you feel it's intentional and the right thing to do, then leave it in. Just asking because the name strikes me as an intermediate state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Going by the code here and here, I'll leave it in as a terminal state.

@victorphoenix3
Copy link
Contributor Author

@ferruzzi A similar polling function exists for Athena queries as well [link]. Should I modify that too?

@ferruzzi
Copy link
Contributor

ferruzzi commented Feb 9, 2022

@victorphoenix3 Yeah, it looks like the exact same issue. If you are up for it, then by all means! But I'd say drop it in a fresh PR so you don't tie this one up.

@victorphoenix3
Copy link
Contributor Author

@ferruzzi Here's the separate PR for athena queries. Both PRs are complete, waiting for your approval. Thanks!

@ferruzzi
Copy link
Contributor

ferruzzi commented Feb 10, 2022

I like it. You'll have to wait for a Committer to approve and merge, but I don't see any issues.

Maybe edit the top post to link to the Athena one as well. A reviewer might see that and take them both at once.

@potiuk
Copy link
Member

potiuk commented Feb 15, 2022

Is it possible to add a unit test for that one (and rebase it ? ) I am happy to approve it but some unit testing could prevent regressions.

@victorphoenix3
Copy link
Contributor Author

@potiuk I have added the unit tests, excuse the delay. Please review.

@potiuk potiuk closed this Mar 7, 2022
@potiuk potiuk reopened this Mar 7, 2022
@potiuk potiuk force-pushed the query-state-check branch from cdc3d6f to b865715 Compare March 7, 2022 13:03
@potiuk
Copy link
Member

potiuk commented Mar 7, 2022

The failing tests were unrelated (I am fixing them in a separate branch and updated constraints to get rid of those errors). I rebased the PR to latest main to re-test it.

@potiuk potiuk force-pushed the query-state-check branch from b865715 to 7ee9c6d Compare March 7, 2022 22:52
@potiuk potiuk merged commit c8d49f6 into apache:main Mar 8, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Mar 8, 2022

Awesome work, congrats on your first merged pull request!

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.

Refactor poll_query_status in EMRContainerHook

3 participants