-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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 a check in BigQueryInsertJobOperator to verify the Job state before marking it as success #40863
Conversation
if job.state in ("PENDING", "RUNNING"): | ||
import time | ||
|
||
time.sleep(5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to add a sleep here. Why not do...
while job.state in ("PENDING", "RUNNING"):
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RNHTTR @kandharvishnu In a second thought, maybe it's better to have a time.sleep()
- otherwise, if it is pending or running for long time - requests will be sent immedately one after another, which might cause exceeding API rate limit.
Example from another Google providers:
time.sleep(wait_check_interval) |
What do you guys think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pankajastro , fyi for #44279
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, if we are looping, then sleep makes sense.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
76e680a
to
1abb8a6
Compare
Suppressed by #44279 |
Closes: 40839
Occasionally, Airflow marks the BigQueryInsertJobOperator task as successful before it has actually completed in BigQuery. To resolve this issue, we will add a condition to check the job's state and wait until it is successfully completed in BigQuery.