Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1025)

Side by Side Diff: telemetry/telemetry/internal/backends/chrome/desktop_browser_finder.py

Issue 2868703002: Retry browser startup in desktop_browser_finder. (Closed)
Patch Set: Stop fetching tab. Clarify retry messages. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 """Finds desktop browsers that can be controlled by telemetry.""" 4 """Finds desktop browsers that can be controlled by telemetry."""
5 5
6 import logging 6 import logging
7 import os 7 import os
8 import sys 8 import sys
9 9
10 import dependency_manager # pylint: disable=import-error 10 import dependency_manager # pylint: disable=import-error
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 def Create(self, finder_options): 53 def Create(self, finder_options):
54 if self._flash_path and not os.path.exists(self._flash_path): 54 if self._flash_path and not os.path.exists(self._flash_path):
55 logging.warning( 55 logging.warning(
56 'Could not find Flash at %s. Continuing without Flash.\n' 56 'Could not find Flash at %s. Continuing without Flash.\n'
57 'To run with Flash, check it out via http://go/read-src-internal', 57 'To run with Flash, check it out via http://go/read-src-internal',
58 self._flash_path) 58 self._flash_path)
59 self._flash_path = None 59 self._flash_path = None
60 60
61 self._InitPlatformIfNeeded() 61 self._InitPlatformIfNeeded()
62 62
63 browser_backend = desktop_browser_backend.DesktopBrowserBackend( 63 num_retries = 3
64 self._platform_backend, 64 for x in range(0, num_retries):
65 finder_options.browser_options, self._local_executable, 65 returned_browser = None
66 self._flash_path, self._is_content_shell, self._browser_directory) 66 try:
67 return browser.Browser( 67 returned_browser = None
68 browser_backend, self._platform_backend, self._credentials_path) 68
69 browser_backend = desktop_browser_backend.DesktopBrowserBackend(
70 self._platform_backend,
71 finder_options.browser_options, self._local_executable,
72 self._flash_path, self._is_content_shell, self._browser_directory)
73
74 returned_browser = browser.Browser(
75 browser_backend, self._platform_backend, self._credentials_path)
76
77 return returned_browser
78 except Exception:
79 report = 'Browser creation failed (attempt %d of %d)' % (
80 (x + 1), num_retries)
81 if x < num_retries - 1:
82 report += ', retrying'
83 logging.warning(report)
84 # Attempt to clean up things left over from the failed browser startup.
85 try:
86 if returned_browser:
87 returned_browser.Close()
88 except Exception:
89 pass
90 # Re-raise the exception the last time through.
91 if x == num_retries - 1:
92 raise
69 93
70 def SupportsOptions(self, browser_options): 94 def SupportsOptions(self, browser_options):
71 if ((len(browser_options.extensions_to_load) != 0) 95 if ((len(browser_options.extensions_to_load) != 0)
72 and self._is_content_shell): 96 and self._is_content_shell):
73 return False 97 return False
74 return True 98 return True
75 99
76 def UpdateExecutableIfNeeded(self): 100 def UpdateExecutableIfNeeded(self):
77 pass 101 pass
78 102
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 if "--ozone-platform" in arg: 303 if "--ozone-platform" in arg:
280 has_ozone_platform = True 304 has_ozone_platform = True
281 305
282 if len(browsers) and not has_x11_display and not has_ozone_platform: 306 if len(browsers) and not has_x11_display and not has_ozone_platform:
283 logging.warning( 307 logging.warning(
284 'Found (%s), but you do not have a DISPLAY environment set.' % 308 'Found (%s), but you do not have a DISPLAY environment set.' %
285 ','.join([b.browser_type for b in browsers])) 309 ','.join([b.browser_type for b in browsers]))
286 return [] 310 return []
287 311
288 return browsers 312 return browsers
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698