[ https://issues.apache.org/jira/browse/BEAM-3861?focusedWorklogId=82447&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-82447 ]
ASF GitHub Bot logged work on BEAM-3861: ---------------------------------------- Author: ASF GitHub Bot Created on: 20/Mar/18 19:55 Start Date: 20/Mar/18 19:55 Worklog Time Spent: 10m Work Description: markflyhigh 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_r175902341 ########## 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: sure. done. ---------------------------------------------------------------- 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: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 82447) Time Spent: 3h (was: 2h 50m) > 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: 3h > Remaining Estimate: 0h > -- This message was sent by Atlassian JIRA (v7.6.3#76005)