Repository navigation
Fix flaky Python tests - #40297
Fix flaky Python tests#40297
Conversation
|
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment |
700e7a8 to
de46d67
Compare
|
Assigning reviewers: R: @tvalentyn for label python. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
tvalentyn
left a comment
There was a problem hiding this comment.
thanks for the help fixing flakes
| raise | ||
| time.sleep(2**(attempt + 1)) | ||
|
|
||
| self.input_topic = _retry_pubsub( |
There was a problem hiding this comment.
Let's use existing utils or tenacity for the retry decorator. I'd try
from apache_beam.utils import retry
gcp_retry = retry.with_exponential_backoff(
num_retries=3,
initial_delay_secs=2,
retry_filter=retry.retry_on_server_errors_timeout_or_quota_issues_filter
)
self.input_topic = gcp_retry(self.pub_client.create_topic)(
name=self.pub_client.topic_path(self.project, INPUT_TOPIC + self.uuid)
)
...
| if ('VertexAIModelHandlerJSON' in str(exn) and | ||
| ('PermissionDenied' in str(exn) or 'NotFound' in str(exn) or | ||
| 'may not exist' in str(exn))): | ||
| self.skipTest(f'Vertex AI test endpoint unavailable: {exn}') |
There was a problem hiding this comment.
('PermissionDenied' in str(exn) or 'NotFound' in str(exn) or
would this silently disable the test due to permission issues?
There was a problem hiding this comment.
hmmm, yes. I don't think we should be skipping tests to hide vertex failures. Removing this.
|
|
||
| # MongoDbContainer's entrypoint restarts mongodb after initial scripts; wait | ||
| # until the server is stable, accepting connections and responds to ping. | ||
| for attempt in range(15): |
There was a problem hiding this comment.
nit: we could use tenacity (already a beam dep for retries like this):
from tenacity import Retrying, stop_after_attempt, wait_fixed
# MongoDbContainer's entrypoint restarts mongodb after initial scripts; wait
# until the server is stable, accepting connections and responds to ping.
for attempt in Retrying(stop=stop_after_attempt(15), wait=wait_fixed(1)):
with attempt:
mongo_client = mongo_container.get_connection_client()
mongo_client.admin.command('ping')
|
Reminder, please take a look at this pr: @tvalentyn @derrickaw @igorbernstein2 |
805b29c to
5edc935
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #40297 +/- ##
=============================================
+ Coverage 56.16% 79.91% +23.74%
=============================================
Files 1124 487 -637
Lines 178336 82308 -96028
Branches 1489 0 -1489
=============================================
- Hits 100170 65775 -34395
+ Misses 75645 16533 -59112
+ Partials 2521 0 -2521
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
please don't squash reviewed and unreviewed commits as it hides the diff. |
No description provided.