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

Pass python model timeout to polling instead of retry #766

Merged
merged 4 commits into from
Jun 21, 2023

Conversation

colin-rogers-dbt
Copy link
Contributor

resolves #577

Description

GCP async interface offers two configurations that both accept the same type: retry and polling. The difference is that retry configures each individual polling request while polling configures the long running operation (i.e. how long to poll for and how frequently to poll). We have been setting retry and not polling resulting in unexpected behavior in job configuration.

Checklist

@colin-rogers-dbt colin-rogers-dbt requested a review from a team as a code owner June 9, 2023 20:33
@colin-rogers-dbt colin-rogers-dbt self-assigned this Jun 9, 2023
@cla-bot cla-bot bot added the cla:yes label Jun 9, 2023
Copy link
Contributor

@github-christophe-oudar github-christophe-oudar left a comment

Choose a reason for hiding this comment

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

nitpicking, LGTM

@@ -43,7 +45,7 @@ def __init__(self, parsed_model: Dict, credential: BigQueryCredentials) -> None:
self.timeout = self.parsed_model["config"].get(
"timeout", self.credential.job_execution_timeout_seconds or 60 * 60 * 24
)
self.retry = retry.Retry(maximum=10.0, deadline=self.timeout)
self.retry = retry.Retry(predicate=POLLING_PREDICATE, maximum=10.0, timeout=self.timeout)
Copy link
Contributor

Choose a reason for hiding this comment

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

According to https://googleapis.dev/python/google-api-core/latest/_modules/google/api_core/future/polling.html
predicate=POLLING_PREDICATE, is already a default so you can skip it

Suggested change
self.retry = retry.Retry(predicate=POLLING_PREDICATE, maximum=10.0, timeout=self.timeout)
self.retry = retry.Retry(maximum=10.0, timeout=self.timeout)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My read on this is that if we supply a custom Retry to polling (i.e. that replaces the DEFAULT_POLLING retry) it won't necessarily add the default polling predicate

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I guess you're right, the DEFAULT_POLLING is not used anymore then and the retry constructor doesn't have a predicate by default

Copy link
Contributor

@ChenyuLInx ChenyuLInx left a comment

Choose a reason for hiding this comment

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

Thanks for adding this!!

Completely out of scope for this issue but something slightly related just for providing context, when submitting python job using serverless(batch job instead of a pre-created cluster), we currently actually waiting for the serverless Dataproc cluster fully destroyed before reporting model finish. It would be helpful to have dbt continue on executing when the job itself is done. Related issue at #734

@@ -98,7 +100,7 @@ def _submit_dataproc_job(self) -> dataproc_v1.types.jobs.Job:
"job": job,
}
)
response = operation.result(retry=self.retry)
response = operation.result(polling=self.retry)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we consider rename self.retry to some thing different like self.poll_policy or self.get_result_policy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good call, I think result_polling_policy is the most explicit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants