RESOLVED FIXED 146175
Get rid of factory json files in benchmark_runner
https://bugs.webkit.org/show_bug.cgi?id=146175
Summary Get rid of factory json files in benchmark_runner
dewei_zhu
Reported 2015-06-19 17:45:45 PDT
Fix the bug introduced by patch 146125 and polish the code.
Attachments
Patch (11.73 KB, patch)
2015-06-19 17:49 PDT, dewei_zhu
no flags
Patch (21.60 KB, patch)
2015-06-20 00:33 PDT, dewei_zhu
no flags
Patch (21.76 KB, patch)
2015-06-20 00:41 PDT, dewei_zhu
no flags
Patch (25.29 KB, patch)
2015-06-22 13:51 PDT, dewei_zhu
no flags
Patch (25.27 KB, patch)
2015-06-22 18:03 PDT, dewei_zhu
no flags
Patch (25.27 KB, patch)
2015-06-22 18:08 PDT, dewei_zhu
no flags
dewei_zhu
Comment 1 2015-06-19 17:49:38 PDT
dewei_zhu
Comment 2 2015-06-20 00:33:37 PDT
WebKit Commit Bot
Comment 3 2015-06-20 00:36:11 PDT
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.
dewei_zhu
Comment 4 2015-06-20 00:41:05 PDT
WebKit Commit Bot
Comment 5 2015-06-20 00:44:06 PDT
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.
Ryosuke Niwa
Comment 6 2015-06-20 00:55:07 PDT
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.
dewei_zhu
Comment 7 2015-06-22 10:35:52 PDT
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!
dewei_zhu
Comment 8 2015-06-22 13:51:26 PDT
WebKit Commit Bot
Comment 9 2015-06-22 13:54:56 PDT
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.
Ryosuke Niwa
Comment 10 2015-06-22 17:39:47 PDT
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.
dewei_zhu
Comment 11 2015-06-22 18:03:53 PDT
WebKit Commit Bot
Comment 12 2015-06-22 18:05:57 PDT
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.
dewei_zhu
Comment 13 2015-06-22 18:08:14 PDT
WebKit Commit Bot
Comment 14 2015-06-22 18:09:54 PDT
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.
WebKit Commit Bot
Comment 15 2015-06-22 20:48:12 PDT
Comment on attachment 255383 [details] Patch Clearing flags on attachment: 255383 Committed r185859: <http://trac.webkit.org/changeset/185859>
WebKit Commit Bot
Comment 16 2015-06-22 20:48:16 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.