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

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: use raw_io instead of json 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
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 common import goma_utils
ukai 2016/08/15 06:54:00 goma_utils in common? it is in slave?
tikuta 2016/08/16 02:16:56 Done.
13
14
15 def start_cloudtail(args, f):
16 """Write process id of started cloudtail to file object f"""
17
18 proc = subprocess.Popen([args.cloudtail_path,
19 'tail',
20 '--log-id', args.log_id,
21 '--path', goma_utils.GetLatestGomaCompilerProxyInfo()],
Yoshisato Yanagisawa 2016/08/15 07:19:30 I want to know the design choice why --log-id is p
tikuta 2016/08/16 02:16:56 Thank you for comment. But I'm not sure why JSON i
Yoshisato Yanagisawa 2016/08/16 02:50:10 As we talked offline, it should be better for clou
tikuta 2016/08/16 02:56:21 Done.
22 )
23
24 f.write(str(proc.pid))
25
26
27 def main():
28 parser = argparse.ArgumentParser(description='cloudtail utility for goma recip e module.')
ukai 2016/08/15 06:54:00 long line?
tikuta 2016/08/16 02:16:56 Done.
29
30 parser.add_argument('--cloudtail-path',
31 help='path of cloudtail binary')
32 parser.add_argument('--log-id',
Yoshisato Yanagisawa 2016/08/16 02:50:10 i.e. I suggest to remove this command line argumen
tikuta 2016/08/16 02:56:21 Done.
33 help='id of log')
34 parser.add_argument('--start-cloudtail', action='store_true',
35 help='start cloudtail if this option is enabled')
36 parser.add_argument('--killed-pid',
37 help='pid that is killed')
Yoshisato Yanagisawa 2016/08/15 07:19:30 Is it allowed to set both start-cloudtail and kill
tikuta 2016/08/16 02:16:56 I wrote assertion and added a message to help.
38
39 args = parser.parse_args()
40
41 if args.start_cloudtail:
42 start_cloudtail(args, sys.stdout)
43
44 if args.killed_pid is not None:
45 os.kill(int(args.killed_pid), signal.SIGTERM)
Yoshisato Yanagisawa 2016/08/15 07:19:30 Don't you wait the program termination? (also SIGK
tikuta 2016/08/16 02:16:56 Done.
46
47
48 if '__main__' == __name__:
49 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698