RESOLVED FIXED Bug 49768
nrwt multiprocessing - add 'worker number' concept, move stuff to worker thread
https://bugs.webkit.org/show_bug.cgi?id=49768
Summary nrwt multiprocessing - add 'worker number' concept, move stuff to worker thread
Dirk Pranke
Reported 2010-11-18 16:22:23 PST
nrwt multiprocessing - add 'worker number' concept, move stuff to worker thread
Attachments
Patch (13.43 KB, patch)
2010-11-18 16:24 PST, Dirk Pranke
no flags
minor cleanup (13.43 KB, patch)
2010-11-18 16:42 PST, Dirk Pranke
no flags
review feedback - sort imports alphabetically (13.43 KB, patch)
2010-11-18 18:19 PST, Dirk Pranke
no flags
Dirk Pranke
Comment 1 2010-11-18 16:24:01 PST
Dirk Pranke
Comment 2 2010-11-18 16:42:42 PST
Created attachment 74321 [details] minor cleanup
Tony Chang
Comment 3 2010-11-18 17:44:17 PST
Comment on attachment 74321 [details] minor cleanup View in context: https://bugs.webkit.org/attachment.cgi?id=74321&action=review > WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:55 > +from webkitpy.layout_tests.test_types import test_type_base > +from webkitpy.layout_tests.test_types import text_diff > +from webkitpy.layout_tests.test_types import image_diff Nit: Sort alphabetically > WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:486 > + self._worker_number, > + self._name, It seems redundant to have to pass worker number and worker name. Are there cases where you can't derive the name from the number? Maybe there should just be a static function somewhere that converts number to name?
Dirk Pranke
Comment 4 2010-11-18 18:19:25 PST
Created attachment 74335 [details] review feedback - sort imports alphabetically
Dirk Pranke
Comment 5 2010-11-18 18:21:31 PST
(In reply to comment #3) > (From update of attachment 74321 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=74321&action=review > > > WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:55 > > +from webkitpy.layout_tests.test_types import test_type_base > > +from webkitpy.layout_tests.test_types import text_diff > > +from webkitpy.layout_tests.test_types import image_diff > > Nit: Sort alphabetically > Done. > > WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:486 > > + self._worker_number, > > + self._name, > > It seems redundant to have to pass worker number and worker name. Are there cases where you can't derive the name from the number? Maybe there should just be a static function somewhere that converts number to name? In fact, if you look at older versions of the rollup patches that's what I used to have. Then I realized that there's no reason for SingleTestThread to know that you can derive worker_name from worker_number, and that this better encapsulate things. I'd prefer to leave it as it is.
Tony Chang
Comment 6 2010-11-19 09:37:42 PST
Comment on attachment 74335 [details] review feedback - sort imports alphabetically View in context: https://bugs.webkit.org/attachment.cgi?id=74335&action=review > WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:171 > + def __init__(self, port, options, worker_number, worker_name, > + test_input, test_types, test_args): My main concern with having a separate name and number is that it makes functions with lots of parameters fragile. Since there's no compile time checking of parameters, it's easy to miss a caller and break things when refactoring. In this case, it's relatively isolated (only this call takes both), so I don't feel that strongly about it. This patch doesn't use worker_number, do you need it in the future? Maybe it should be added when it's used?
Tony Chang
Comment 7 2010-11-19 09:39:03 PST
Another option for encapsulating is to make a small class that combines worker name and number. You could have a getter on the class that derives the name from the number.
Dirk Pranke
Comment 8 2010-11-19 10:14:09 PST
(In reply to comment #6) > (From update of attachment 74335 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=74335&action=review > > > WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:171 > > + def __init__(self, port, options, worker_number, worker_name, > > + test_input, test_types, test_args): > > My main concern with having a separate name and number is that it makes functions with lots of parameters fragile. Since there's no compile time checking of parameters, it's easy to miss a caller and break things when refactoring. > It's a fair concern. A bunch of these arguments go away in subsequent patches.
Dirk Pranke
Comment 9 2010-11-19 17:50:02 PST
Comment on attachment 74335 [details] review feedback - sort imports alphabetically Clearing flags on attachment: 74335 Committed r72458: <http://trac.webkit.org/changeset/72458>
Dirk Pranke
Comment 10 2010-11-19 17:50:07 PST
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.