[autotest] Add a log socket server for RPM controller to write log from multiple processes

set_power_state call is executed in a new process. logging to a single file
from multiple process may cause the process to hang. A reliable solution is to
create a SocketHandler to log to a TCP server. The source code is from python
documentation:
https://docs.python.org/2/howto/logging-cookbook.html#network-logging

BUG=chromium:243567
DEPLOY=rpm
TEST=unittest, local test script
modify frontend_addr in rpm_config.ini to localhost
Add a dummy set_power_state call in rpm_controller.py to wait indefinitely.
Also add some logging call in it.
Run frontend_server and rpm_dispatcher in localhost
Run a test script that calls 500 duts, e.g., chromeos1-rack#-host 1, #=1-500
Wait for all calls to time out, check ps to make sure only 2 rpm_dispatcher
processes are running at the end (the additional one is for the TCP server
collecting log).

Change-Id: I594cb55c9a2230ac34c90eca7e9de355c21a0dca
Reviewed-on: https://chromium-review.googlesource.com/194432
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Alex Miller <milleral@chromium.org>
Commit-Queue: Dan Shi <dshi@chromium.org>
5 files changed