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

Issue 18086004: Move Python setup/tear down logic into Forwarder itself. (Closed)

Created:
7 years, 5 months ago by Philippe
Modified:
7 years, 5 months ago
Reviewers:
bulach, frankf, pliard
CC:
chromium-reviews, craigdh+watch_chromium.org, kkania, chrome-speed-team+watch_google.com, bulach+watch_chromium.org, yfriedman+watch_chromium.org, ilevy-cc_chromium.org, klundberg+watch_chromium.org, telemetry+watch_chromium.org, frankf+watch_chromium.org
Visibility:
Public.

Description

Move Python setup/tear down logic into Forwarder itself. Forwarder used to be a pain to setup/tear down across all the various harnesses. This CL should hopefully solve these issues by hiding these implementation details. The host daemon is now killed once the first time that the Forwarder class is used and the daemon running on the devices is also killed the first time a port is forwarded for a specific device. BUG=242846 R=bulach@chromium.org, frankf@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=212020

Patch Set 1 #

Patch Set 2 : #

Total comments: 13

Patch Set 3 : Address Frank's comments + use multiprocess lock #

Patch Set 4 : Use file lock #

Total comments: 6

Patch Set 5 : Implement Marcus' idea #

Total comments: 34

Patch Set 6 : Address Marcus' and Frank's comments #

Patch Set 7 : Do not share lock instance #

Patch Set 8 : Update outdated comment #

Total comments: 2

Patch Set 9 : Address Frank's comments #

Total comments: 2

Patch Set 10 : Address Marcus' comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+252 lines, -176 lines) Patch
M build/android/adb_reverse_forwarder.py View 1 2 3 4 5 2 chunks +2 lines, -6 lines 0 comments Download
M build/android/bb_run_sharded_steps.py View 1 2 3 4 5 2 chunks +2 lines, -1 line 0 comments Download
M build/android/pylib/base/base_test_runner.py View 1 2 3 4 5 6 7 8 4 chunks +15 lines, -30 lines 0 comments Download
M build/android/pylib/base/shard.py View 3 chunks +0 lines, -4 lines 0 comments Download
M build/android/pylib/chrome_test_server_spawner.py View 8 chunks +6 lines, -11 lines 0 comments Download
M build/android/pylib/forwarder.py View 1 2 3 4 5 6 7 8 9 5 chunks +211 lines, -82 lines 0 comments Download
M build/android/pylib/host_driven/python_test_sharder.py View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M build/android/pylib/instrumentation/test_runner.py View 1 2 3 4 5 6 7 8 2 chunks +3 lines, -4 lines 0 comments Download
M chrome/test/chromedriver/run_py_tests.py View 1 2 3 4 5 1 chunk +4 lines, -9 lines 0 comments Download
M chrome/test/chromedriver/test_environment.py View 1 2 3 4 5 1 chunk +3 lines, -8 lines 0 comments Download
tools/telemetry/telemetry/core/chrome/adb_commands.py View 1 2 3 4 5 2 chunks +5 lines, -16 lines 0 comments Download
M tools/telemetry/telemetry/core/chrome/android_browser_backend.py View 1 2 3 4 5 1 chunk +0 lines, -4 lines 0 comments Download

Messages

Total messages: 32 (0 generated)
Philippe
7 years, 5 months ago (2013-07-10 12:42:50 UTC) #1
frankf
Thanks pliard, this is much cleaner. https://codereview.chromium.org/18086004/diff/6001/build/android/pylib/base/base_test_runner.py File build/android/pylib/base/base_test_runner.py (right): https://codereview.chromium.org/18086004/diff/6001/build/android/pylib/base/base_test_runner.py#newcode146 build/android/pylib/base/base_test_runner.py:146: Forwarder.Map(port_pairs, self.adb, self.build_type, ...
7 years, 5 months ago (2013-07-10 18:15:38 UTC) #2
Philippe
I also moved to multiprocessing.Lock which should address the multiprocess synchronization issue. ipcs didn't show ...
7 years, 5 months ago (2013-07-11 09:34:06 UTC) #3
bulach
sorry, I should've seen this yesterday, my bad!! for the reasons explained in the other ...
7 years, 5 months ago (2013-07-11 09:36:02 UTC) #4
pliard
On 2013/07/11 09:36:02, bulach wrote: > sorry, I should've seen this yesterday, my bad!! > ...
7 years, 5 months ago (2013-07-11 09:44:10 UTC) #5
bulach
actually, we just need a known file name :) something like: import os f = ...
7 years, 5 months ago (2013-07-11 09:46:31 UTC) #6
bulach
I think multiprocessing.Lock has to be passed down from the parent process, right? that is, ...
7 years, 5 months ago (2013-07-11 09:50:10 UTC) #7
Philippe
I have just uploaded a new patch set using a file lock. As Marcus said ...
7 years, 5 months ago (2013-07-11 13:58:48 UTC) #8
Philippe
On 2013/07/11 13:58:48, Philippe wrote: > I have just uploaded a new patch set using ...
7 years, 5 months ago (2013-07-11 14:00:55 UTC) #9
frankf
On 2013/07/11 14:00:55, Philippe wrote: > On 2013/07/11 13:58:48, Philippe wrote: > > I have ...
7 years, 5 months ago (2013-07-11 16:15:29 UTC) #10
bulach
telemetry and all perf tests uses multiprocess: http://src.chromium.org/viewvc/chrome/trunk/src/build/android/bb_run_sharded_steps.py it'd be nice not to, but I ...
7 years, 5 months ago (2013-07-11 16:22:37 UTC) #11
bulach
sorry, I should clarify: all perf tests downstream.. upstream they are not at all sharded, ...
7 years, 5 months ago (2013-07-11 16:24:06 UTC) #12
pliard
On 2013/07/11 16:24:06, bulach wrote: > sorry, I should clarify: all perf tests downstream.. > ...
7 years, 5 months ago (2013-07-12 08:42:30 UTC) #13
bulach
thanks phillippe! I like moving all this logic into the forwarder, certainly hides all the ...
7 years, 5 months ago (2013-07-12 11:48:25 UTC) #14
frankf
https://codereview.chromium.org/18086004/diff/24001/build/android/pylib/forwarder.py File build/android/pylib/forwarder.py (right): https://codereview.chromium.org/18086004/diff/24001/build/android/pylib/forwarder.py#newcode33 build/android/pylib/forwarder.py:33: fcntl.flock(self._file, fcntl.LOCK_EX) Are you suggesting the first process holds ...
7 years, 5 months ago (2013-07-12 21:56:55 UTC) #15
bulach
https://codereview.chromium.org/18086004/diff/24001/build/android/pylib/forwarder.py File build/android/pylib/forwarder.py (right): https://codereview.chromium.org/18086004/diff/24001/build/android/pylib/forwarder.py#newcode33 build/android/pylib/forwarder.py:33: fcntl.flock(self._file, fcntl.LOCK_EX) On 2013/07/12 21:56:56, frankf wrote: > Are ...
7 years, 5 months ago (2013-07-15 09:32:29 UTC) #16
pliard
https://codereview.chromium.org/18086004/diff/24001/build/android/pylib/forwarder.py File build/android/pylib/forwarder.py (right): https://codereview.chromium.org/18086004/diff/24001/build/android/pylib/forwarder.py#newcode33 build/android/pylib/forwarder.py:33: fcntl.flock(self._file, fcntl.LOCK_EX) On 2013/07/15 09:32:30, bulach wrote: > On ...
7 years, 5 months ago (2013-07-15 09:44:29 UTC) #17
bulach
https://codereview.chromium.org/18086004/diff/24001/build/android/pylib/forwarder.py File build/android/pylib/forwarder.py (right): https://codereview.chromium.org/18086004/diff/24001/build/android/pylib/forwarder.py#newcode33 build/android/pylib/forwarder.py:33: fcntl.flock(self._file, fcntl.LOCK_EX) On 2013/07/15 09:44:29, pliard wrote: > On ...
7 years, 5 months ago (2013-07-15 10:20:02 UTC) #18
pliard
https://codereview.chromium.org/18086004/diff/24001/build/android/pylib/forwarder.py File build/android/pylib/forwarder.py (right): https://codereview.chromium.org/18086004/diff/24001/build/android/pylib/forwarder.py#newcode33 build/android/pylib/forwarder.py:33: fcntl.flock(self._file, fcntl.LOCK_EX) On 2013/07/15 10:20:03, bulach wrote: > On ...
7 years, 5 months ago (2013-07-15 10:51:10 UTC) #19
bulach
got, thanks! :) we'll need the ppid checking otherwise it'd break the sharded telemetry tests ...
7 years, 5 months ago (2013-07-15 10:54:40 UTC) #20
pliard
On 2013/07/15 10:54:40, bulach wrote: > got, thanks! :) we'll need the ppid checking otherwise ...
7 years, 5 months ago (2013-07-15 15:21:46 UTC) #21
bulach
sigh, good point! :( I think the python-driven is about to move away of multi-process: ...
7 years, 5 months ago (2013-07-15 15:43:18 UTC) #22
Philippe
PTAL :)
7 years, 5 months ago (2013-07-15 16:40:44 UTC) #23
bulach
lgtm, thanks! just some nits and suggestions below, it looks this will be robust for ...
7 years, 5 months ago (2013-07-15 17:51:43 UTC) #24
frankf
https://codereview.chromium.org/18086004/diff/51001/build/android/adb_reverse_forwarder.py File build/android/adb_reverse_forwarder.py (right): https://codereview.chromium.org/18086004/diff/51001/build/android/adb_reverse_forwarder.py#newcode61 build/android/adb_reverse_forwarder.py:61: Forwarder.UnmapDevicePort(device_port, adb) You can use UnmapPorts() https://codereview.chromium.org/18086004/diff/51001/build/android/pylib/base/base_test_runner.py File build/android/pylib/base/base_test_runner.py ...
7 years, 5 months ago (2013-07-15 22:23:22 UTC) #25
Philippe
Thanks guys! In addition to addressing your comments, I also slightly modified the device to ...
7 years, 5 months ago (2013-07-16 12:31:21 UTC) #26
frankf
lgtm w/ nits. Thanks. https://codereview.chromium.org/18086004/diff/78003/build/android/pylib/forwarder.py File build/android/pylib/forwarder.py (right): https://codereview.chromium.org/18086004/diff/78003/build/android/pylib/forwarder.py#newcode143 build/android/pylib/forwarder.py:143: if adb_serial == device_serial: Perhaps ...
7 years, 5 months ago (2013-07-16 18:31:01 UTC) #27
bulach
lgtm, thanks! tiny nit: https://codereview.chromium.org/18086004/diff/92013/build/android/pylib/forwarder.py File build/android/pylib/forwarder.py (right): https://codereview.chromium.org/18086004/diff/92013/build/android/pylib/forwarder.py#newcode207 build/android/pylib/forwarder.py:207: if not serial_with_port in instance._device_to_host_port_map: ...
7 years, 5 months ago (2013-07-17 10:20:18 UTC) #28
Philippe
Thanks Marcus! https://chromiumcodereview.appspot.com/18086004/diff/92013/build/android/pylib/forwarder.py File build/android/pylib/forwarder.py (right): https://chromiumcodereview.appspot.com/18086004/diff/92013/build/android/pylib/forwarder.py#newcode207 build/android/pylib/forwarder.py:207: if not serial_with_port in instance._device_to_host_port_map: On 2013/07/17 ...
7 years, 5 months ago (2013-07-17 10:24:38 UTC) #29
Philippe
Committed patchset #10 manually as r212020 (presubmit successful).
7 years, 5 months ago (2013-07-17 13:43:04 UTC) #30
pliard
This seems to be flaky :/ I will revert it and try locally with the ...
7 years, 5 months ago (2013-07-17 15:49:47 UTC) #31
pliard
7 years, 5 months ago (2013-07-17 15:57:07 UTC) #32
The issue doesn't seem to be caused by excessive daemon kills (i.e. there
is only a single host forwarder kill and one kill for each device as
expected). So it would rather be a problem caused by premature/excessive
port unmappings.


On Wed, Jul 17, 2013 at 5:49 PM, Philippe Liard <pliard@google.com> wrote:

> This seems to be flaky :/ I will revert it and try locally with the same
> conditions (6 devices being sharded).
>
>
> On Wed, Jul 17, 2013 at 3:43 PM, <pliard@chromium.org> wrote:
>
>> Committed patchset #10 manually as r212020 (presubmit successful).
>>
>>
https://codereview.chromium.**org/18086004/<https://codereview.chromium.org/1...
>>
>
>

Powered by Google App Engine
This is Rietveld 408576698