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

Unified Diff: testing/legion/client_controller.py

Issue 890773003: Adding the initial code for Omnibot multi-machine support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Doing a little refactoring and changes. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: testing/legion/client_controller.py
diff --git a/testing/legion/client_controller.py b/testing/legion/client_controller.py
new file mode 100755
index 0000000000000000000000000000000000000000..f5c144fc56cc95b88bd4ca685093ddf55ab28a21
--- /dev/null
+++ b/testing/legion/client_controller.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""The main client_controller code.
+
+This code is the main entry point for the client machines and handles
+registering with the host server and running the local RPC server.
+"""
+
+import argparse
+import logging
+import socket
+import sys
+import time
+
+#pylint: disable=relative-import
+import client_rpc_server
+import common_lib
+
+
+def main():
+ common_lib.PrintCommandLine()
+ common_lib.InitLogging()
+ logging.info('Client controller starting')
+
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--otp')
+ parser.add_argument('--host')
+ parser.add_argument('--idle-timeout', type=int,
+ default=common_lib.DEFAULT_TIMEOUT_SECS)
+ args, _ = parser.parse_known_args()
+
+ logging.info(
+ 'Registering with discovery server at %s using OTP %s', args.host,
+ args.otp)
+ server = common_lib.ConnectToServer(args.host).RegisterClient(
+ args.otp, common_lib.MY_IP)
+
+ server = client_rpc_server.RPCServer(args.host, args.idle_timeout)
+
+ server.serve_forever()
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main())

Powered by Google App Engine
This is Rietveld 408576698