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

Unified Diff: scripts/slave/recipe_modules/goma/resources/cloudtail_utils.py

Issue 2237403002: Add cloudtail start/stop in recipe_modules/goma (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: remove a try-finally Created 4 years, 4 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
« no previous file with comments | « scripts/slave/recipe_modules/goma/example.expected/win_upload_logs.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/recipe_modules/goma/resources/cloudtail_utils.py
diff --git a/scripts/slave/recipe_modules/goma/resources/cloudtail_utils.py b/scripts/slave/recipe_modules/goma/resources/cloudtail_utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..1410432c8b0e367fa7fe77856cebcd9867190ac3
--- /dev/null
+++ b/scripts/slave/recipe_modules/goma/resources/cloudtail_utils.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+# Copyright (c) 2016 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.
+
+import argparse
+import os
+import signal
+import subprocess
+import sys
+
+from slave import goma_utils
+
+
+def start_cloudtail(args):
+ """Write process id of started cloudtail to file object f"""
+
+ proc = subprocess.Popen([args.cloudtail_path,
+ 'tail',
+ '--log-id', 'goma_compiler_proxy'
+ '--path',
+ goma_utils.GetLatestGomaCompilerProxyInfo()])
+
+ sys.stdout.write(str(proc.pid))
+
+
+def main():
+ parser = argparse.ArgumentParser(
+ description='cloudtail utility for goma recipe module.')
+
+ subparsers = parser.add_subparsers(help='commands for cloudtail')
+
+ parser_start = subparsers.add_parser('start',
+ help='subcommand to start cloudtail')
+ parser_start.set_defaults(command='start')
+ parser_start.add_argument('--cloudtail-path', required=True,
+ help='path of cloudtail binary')
+
+ parser_stop = subparsers.add_parser('stop',
+ help='subcommand to stop cloudtail')
+ parser_stop.set_defaults(command='stop')
+ parser_stop.add_argument('--killed-pid', type=int, required=True,
+ help='pid that is killed.')
+
+ args = parser.parse_args()
+
+ if args.command == 'start':
+ start_cloudtail(args)
+ elif args.command == 'stop':
+ os.kill(args.killed_pid, signal.SIGKILL)
+
+
+if '__main__' == __name__:
+ sys.exit(main())
« no previous file with comments | « scripts/slave/recipe_modules/goma/example.expected/win_upload_logs.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698