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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import argparse
7 import os
8 import signal
9 import subprocess
10 import sys
11
12 from slave import goma_utils
13
14
15 def start_cloudtail(args):
16 """Write process id of started cloudtail to file object f"""
17
18 proc = subprocess.Popen([args.cloudtail_path,
19 'tail',
20 '--log-id', 'goma_compiler_proxy'
21 '--path',
22 goma_utils.GetLatestGomaCompilerProxyInfo()])
23
24 sys.stdout.write(str(proc.pid))
25
26
27 def main():
28 parser = argparse.ArgumentParser(
29 description='cloudtail utility for goma recipe module.')
30
31 subparsers = parser.add_subparsers(help='commands for cloudtail')
32
33 parser_start = subparsers.add_parser('start',
34 help='subcommand to start cloudtail')
35 parser_start.set_defaults(command='start')
36 parser_start.add_argument('--cloudtail-path', required=True,
37 help='path of cloudtail binary')
38
39 parser_stop = subparsers.add_parser('stop',
40 help='subcommand to stop cloudtail')
41 parser_stop.set_defaults(command='stop')
42 parser_stop.add_argument('--killed-pid', type=int, required=True,
43 help='pid that is killed.')
44
45 args = parser.parse_args()
46
47 if args.command == 'start':
48 start_cloudtail(args)
49 elif args.command == 'stop':
50 os.kill(args.killed_pid, signal.SIGKILL)
51
52
53 if '__main__' == __name__:
54 sys.exit(main())
OLDNEW
« 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