[
https://issues.apache.org/jira/browse/BEAM-3861?focusedWorklogId=82088&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-82088
]
ASF GitHub Bot logged work on BEAM-3861:
----------------------------------------
Author: ASF GitHub Bot
Created on: 19/Mar/18 23:27
Start Date: 19/Mar/18 23:27
Worklog Time Spent: 10m
Work Description: aaltay commented on a change in pull request #4874:
[BEAM-3861] Improve test infra in Python SDK for streaming end-to-end test
URL: https://github.com/apache/beam/pull/4874#discussion_r175616557
##########
File path: sdks/python/apache_beam/testing/test_utils.py
##########
@@ -129,3 +131,47 @@ def delete_files(file_paths):
raise RuntimeError('Clean up failed. Invalid file path: %s.' %
file_paths)
FileSystems.delete(file_paths)
+
+
+def wait_for_subscriptions_created(subs, timeout=60):
+ """Wait for all PubSub subscriptions are created."""
+ return _wait_until_all_exist(subs, timeout)
+
+
+def wait_for_topics_created(topics, timeout=60):
+ """Wait for all PubSub topics are created."""
+ return _wait_until_all_exist(topics, timeout)
+
+
+def _wait_until_all_exist(components, timeout):
+ need_wait = set(components)
+ start_time = time.time()
+ while time.time() - start_time <= timeout:
+ for c in components:
+ if c in need_wait and c.exists():
+ need_wait.remove(c)
+ if len(need_wait) == 0:
+ return True
+ time.sleep(2)
+
+ raise RuntimeError('Timeout after %d seconds. %d of %d topics/subscriptions '
Review comment:
Would it be helpful if you log what does not exist?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 82088)
Time Spent: 50m (was: 40m)
> Build test infra for end-to-end streaming test in Python SDK
> ------------------------------------------------------------
>
> Key: BEAM-3861
> URL: https://issues.apache.org/jira/browse/BEAM-3861
> Project: Beam
> Issue Type: Task
> Components: testing
> Reporter: Mark Liu
> Assignee: Mark Liu
> Priority: Major
> Time Spent: 50m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)