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

Improve DataprocCreateClusterOperator in Triggers for Enhanced Error Handling and Resource Cleanup #39130

Merged
merged 9 commits into from
Apr 26, 2024

Conversation

sunank200
Copy link
Collaborator

This PR introduces improvements to the DataprocCreateClusterOperator, specifically addressing deficiencies in handling clusters that are created in an ERROR state when operating in deferrable mode

Previously, when the DataprocCreateClusterOperator was operating in deferrable mode, it did not correctly handle scenarios where clusters were initially created in an ERROR state. The lack of appropriate error handling and resource cleanup led to subsequent retries encountering these errored clusters, attempting deletion, and resulting in pipeline failures.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@boring-cyborg boring-cyborg bot added area:providers provider:google Google (including GCP) related issues labels Apr 19, 2024
@sunank200 sunank200 force-pushed the google_dataproc_create_cluster_fix branch 5 times, most recently from 75bff4f to 51eef81 Compare April 22, 2024 15:57
@sunank200 sunank200 marked this pull request as ready for review April 22, 2024 16:20
@sunank200 sunank200 force-pushed the google_dataproc_create_cluster_fix branch from 51eef81 to c133c83 Compare April 22, 2024 17:25
@sunank200 sunank200 force-pushed the google_dataproc_create_cluster_fix branch from c133c83 to 443e9f8 Compare April 22, 2024 17:27
airflow/providers/google/cloud/triggers/dataproc.py Outdated Show resolved Hide resolved
airflow/providers/google/cloud/triggers/dataproc.py Outdated Show resolved Hide resolved
airflow/providers/google/cloud/triggers/dataproc.py Outdated Show resolved Hide resolved
airflow/providers/google/cloud/triggers/dataproc.py Outdated Show resolved Hide resolved
airflow/providers/google/cloud/triggers/dataproc.py Outdated Show resolved Hide resolved
airflow/providers/google/cloud/triggers/dataproc.py Outdated Show resolved Hide resolved
airflow/providers/google/cloud/triggers/dataproc.py Outdated Show resolved Hide resolved
airflow/providers/google/cloud/triggers/dataproc.py Outdated Show resolved Hide resolved
airflow/providers/google/cloud/triggers/dataproc.py Outdated Show resolved Hide resolved
airflow/providers/google/cloud/triggers/dataproc.py Outdated Show resolved Hide resolved
airflow/providers/google/cloud/triggers/dataproc.py Outdated Show resolved Hide resolved
airflow/providers/google/cloud/triggers/dataproc.py Outdated Show resolved Hide resolved
@sunank200 sunank200 force-pushed the google_dataproc_create_cluster_fix branch from 7b5e114 to ee85f59 Compare April 23, 2024 09:34
@sunank200 sunank200 force-pushed the google_dataproc_create_cluster_fix branch 2 times, most recently from 18598b3 to 55e50d3 Compare April 23, 2024 11:21

self.log.info("Sleeping for %s seconds.", self.polling_interval_seconds)
await asyncio.sleep(self.polling_interval_seconds)
except asyncio.CancelledError:
Copy link
Member

Choose a reason for hiding this comment

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

Would like to understand when exactly is the CancelledError raised.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is raised when the user marks the task as failed.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like there are other cases too when CancelledError is raised e.g. when the trigger restarts as mentioned in #36090 (comment)

We might need some additional measures here.

airflow/providers/google/cloud/triggers/dataproc.py Outdated Show resolved Hide resolved
airflow/providers/google/cloud/triggers/dataproc.py Outdated Show resolved Hide resolved
@sunank200 sunank200 force-pushed the google_dataproc_create_cluster_fix branch from 55e50d3 to 63bfab1 Compare April 24, 2024 05:47
@sunank200 sunank200 force-pushed the google_dataproc_create_cluster_fix branch 4 times, most recently from 5fa0f7a to 86a43db Compare April 24, 2024 12:35
@sunank200 sunank200 force-pushed the google_dataproc_create_cluster_fix branch from 7de3c9f to c47de1f Compare April 24, 2024 15:04
@sunank200 sunank200 force-pushed the google_dataproc_create_cluster_fix branch from c47de1f to b261f33 Compare April 25, 2024 06:59
Copy link
Collaborator

@vatsrahul1001 vatsrahul1001 left a comment

Choose a reason for hiding this comment

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

Tested this on local and Astro working fine

@sunank200 sunank200 force-pushed the google_dataproc_create_cluster_fix branch 2 times, most recently from e0cacb5 to e28fff9 Compare April 25, 2024 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers provider:google Google (including GCP) related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants