reuvenlax commented on code in PR #40297:
URL: https://github.com/apache/beam/pull/40297#discussion_r4262997380


##########
sdks/python/apache_beam/io/gcp/pubsub_integration_test.py:
##########
@@ -138,23 +138,39 @@ def setUp(self):
     self.project = self.test_pipeline.get_option('project')
     self.uuid = str(uuid.uuid4())
 
-    # Set up PubSub environment.
+    # Set up PubSub environment with retries for transient 504/403 API errors.
     from google.cloud import pubsub
     self.pub_client = pubsub.PublisherClient()
-    self.input_topic = self.pub_client.create_topic(
-        name=self.pub_client.topic_path(self.project, INPUT_TOPIC + self.uuid))
-    self.output_topic = self.pub_client.create_topic(
-        name=self.pub_client.topic_path(self.project, OUTPUT_TOPIC + 
self.uuid))
-
     self.sub_client = pubsub.SubscriberClient()
-    self.input_sub = self.sub_client.create_subscription(
-        name=self.sub_client.subscription_path(
-            self.project, INPUT_SUB + self.uuid),
-        topic=self.input_topic.name)
-    self.output_sub = self.sub_client.create_subscription(
-        name=self.sub_client.subscription_path(
-            self.project, OUTPUT_SUB + self.uuid),
-        topic=self.output_topic.name)
+
+    def _retry_pubsub(fn):
+      for attempt in range(4):
+        try:
+          return fn()
+        except Exception:
+          if attempt == 3:
+            raise
+          time.sleep(2**(attempt + 1))
+
+    self.input_topic = _retry_pubsub(

Review Comment:
   done



##########
sdks/python/apache_beam/yaml/integration_tests.py:
##########
@@ -327,6 +327,18 @@ def temp_mongodb_table():
     mongo_container.start()
     mongo_uri = mongo_container.get_connection_url()
 
+    # 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):

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to