Summary: | Get rid of factory json files in benchmark_runner | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | dewei_zhu | ||||||||||||||
Component: | New Bugs | Assignee: | Nobody <webkit-unassigned> | ||||||||||||||
Status: | RESOLVED FIXED | ||||||||||||||||
Severity: | Normal | CC: | commit-queue, dewei_zhu, glenn, rniwa | ||||||||||||||
Priority: | P2 | ||||||||||||||||
Version: | 528+ (Nightly build) | ||||||||||||||||
Hardware: | Unspecified | ||||||||||||||||
OS: | Unspecified | ||||||||||||||||
Attachments: |
|
Description
dewei_zhu
2015-06-19 17:45:45 PDT
Created attachment 255257 [details]
Patch
Created attachment 255284 [details]
Patch
Attachment 255284 [details] did not pass style-queue:
ERROR: Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:39: [OSXBrowserDriver.terminateProcesses] No name 'NSRunningApplication' in module 'AppKit' [pylint/E0611] [5]
ERROR: Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:52: [OSXBrowserDriver.screenSize] No name 'NSScreen' in module 'AppKit' [pylint/E0611] [5]
Total errors found: 2 in 18 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 255286 [details]
Patch
Attachment 255286 [details] did not pass style-queue:
ERROR: Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:39: [OSXBrowserDriver.terminateProcesses] No name 'NSRunningApplication' in module 'AppKit' [pylint/E0611] [5]
ERROR: Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:52: [OSXBrowserDriver.screenSize] No name 'NSScreen' in module 'AppKit' [pylint/E0611] [5]
Total errors found: 2 in 18 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 255286 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=255286&action=review > Tools/Scripts/webkitpy/benchmark_runner/benchmark_builder/__init__.py:15 > +import imp We don't need imp here. > Tools/Scripts/webkitpy/benchmark_runner/browser_driver/__init__.py:15 > +import imp Ditto. > Tools/Scripts/webkitpy/benchmark_runner/browser_driver/__init__.py:23 > + BrowserDriverFactory.add_product([browser_driver_class.platform, browser_driver_class.browser_name], browser_driver_class) This code is unreadable. We should just not use GenericFactory.add_product here. Just add add_browser_driver(platform, browser_name, browser_driver_class) or something to BrowserDriverFactory. > Tools/Scripts/webkitpy/benchmark_runner/generic_factory.py:38 > + @classmethod > + def add_product(cls, descriptions, product): > + item = cls.products > + for description in descriptions[:-1]: > + if description not in item: > + item[description] = {} > + item = item[description] > + item[descriptions[-1]] = product This method is super generic and impossible to reason about. I'd much prefer duplicating the code in each driver factory instead. > Tools/Scripts/webkitpy/benchmark_runner/utils.py:21 > + if inspect.isclass(child): > + if parent_name in [cls.__name__ for cls in inspect.getmro(child)]: > + return True > + return False This should be re-rewritten as: return inspect.isclass(child) and parent_name in [cls.__name__ for cls in inspect.getmro(child)] > Tools/Scripts/webkitpy/benchmark_runner/utils.py:26 > + if filename.endswith('.py') and filename not in ['__init__.py']: Instead of nesting if-s, use "continue" and detect the rest per WebKit coding style. Alternatively, use list comprehension. Comment on attachment 255286 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=255286&action=review > Tools/Scripts/webkitpy/benchmark_runner/benchmark_builder/__init__.py:23 > + BenchmarkBuilderFactory.add_product([benchmark_builder_class.builder_name], benchmark_builder_class) Should I add a add_benchmark_builder method instead? > Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/__init__.py:23 > + HTTPServerDriverFactory.add_product([http_server_driver_class.name], http_server_driver_class) Should I change here as well? >> Tools/Scripts/webkitpy/benchmark_runner/utils.py:21 >> + return False > > This should be re-rewritten as: > return inspect.isclass(child) and parent_name in [cls.__name__ for cls in inspect.getmro(child)] Nice! Created attachment 255366 [details]
Patch
Attachment 255366 [details] did not pass style-queue:
ERROR: Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:39: [OSXBrowserDriver.terminateProcesses] No name 'NSRunningApplication' in module 'AppKit' [pylint/E0611] [5]
ERROR: Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:52: [OSXBrowserDriver.screenSize] No name 'NSScreen' in module 'AppKit' [pylint/E0611] [5]
Total errors found: 2 in 18 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 255366 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=255366&action=review > Tools/Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver_factory.py:32 > + def get(cls, platform, browser_name): I don't think we should rename this to `get`. `create` is more semantically correct name. Created attachment 255381 [details]
Patch
Attachment 255381 [details] did not pass style-queue:
ERROR: Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:39: [OSXBrowserDriver.terminateProcesses] No name 'NSRunningApplication' in module 'AppKit' [pylint/E0611] [5]
ERROR: Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:52: [OSXBrowserDriver.screenSize] No name 'NSScreen' in module 'AppKit' [pylint/E0611] [5]
Total errors found: 2 in 18 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 255383 [details]
Patch
Attachment 255383 [details] did not pass style-queue:
ERROR: Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:39: [OSXBrowserDriver.terminateProcesses] No name 'NSRunningApplication' in module 'AppKit' [pylint/E0611] [5]
ERROR: Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:52: [OSXBrowserDriver.screenSize] No name 'NSScreen' in module 'AppKit' [pylint/E0611] [5]
Total errors found: 2 in 18 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 255383 [details] Patch Clearing flags on attachment: 255383 Committed r185859: <http://trac.webkit.org/changeset/185859> All reviewed patches have been landed. Closing bug. |