summaryrefslogtreecommitdiffstats
path: root/testing/legion/run_task.py
diff options
context:
space:
mode:
authormmeade <mmeade@chromium.org>2015-02-19 17:21:04 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-20 01:21:55 +0000
commit23ded056be7f3652fd4c94c69a172b3a80c50266 (patch)
treed06a7ba7b011e0df84142988dec8411b72c7025a /testing/legion/run_task.py
parent5bd346fa76109901ad5b3ee6857eeb5808584eb6 (diff)
downloadchromium_src-23ded056be7f3652fd4c94c69a172b3a80c50266.zip
chromium_src-23ded056be7f3652fd4c94c69a172b3a80c50266.tar.gz
chromium_src-23ded056be7f3652fd4c94c69a172b3a80c50266.tar.bz2
Changing from a host/client idea to a task/test coordinator idea
BUG=460183 Review URL: https://codereview.chromium.org/921963005 Cr-Commit-Position: refs/heads/master@{#317207}
Diffstat (limited to 'testing/legion/run_task.py')
-rwxr-xr-xtesting/legion/run_task.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/testing/legion/run_task.py b/testing/legion/run_task.py
new file mode 100755
index 0000000..6a55073
--- /dev/null
+++ b/testing/legion/run_task.py
@@ -0,0 +1,47 @@
+#!/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 task entrypoint."""
+
+import argparse
+import logging
+import socket
+import sys
+import time
+
+#pylint: disable=relative-import
+import common_lib
+import rpc_server
+
+
+def main():
+ print ' '.join(sys.argv)
+ common_lib.InitLogging()
+ logging.info('Task starting')
+
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--otp',
+ help='One time token used to authenticate with the host')
+ parser.add_argument('--controller',
+ help='The ip address of the controller machine')
+ parser.add_argument('--idle-timeout', type=int,
+ default=common_lib.DEFAULT_TIMEOUT_SECS,
+ help='The idle timeout for the rpc server in seconds')
+ args, _ = parser.parse_known_args()
+
+ logging.info(
+ 'Registering with registration server at %s using OTP "%s"',
+ args.controller, args.otp)
+ server = common_lib.ConnectToServer(args.controller).RegisterTask(
+ args.otp, common_lib.MY_IP)
+
+ server = rpc_server.RPCServer(args.controller, args.idle_timeout)
+
+ server.serve_forever()
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main())