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

Side by Side Diff: server/autoserv

Issue 6246035: Merge remote branch 'cros/upstream' into master (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 10 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/python -u 1 #!/usr/bin/python -u
2 # Copyright 2007-2008 Martin J. Bligh <mbligh@google.com>, Google Inc. 2 # Copyright 2007-2008 Martin J. Bligh <mbligh@google.com>, Google Inc.
3 # Released under the GPL v2 3 # Released under the GPL v2
4 4
5 """ 5 """
6 Run an control file through the server side engine 6 Run an control file through the server side engine
7 """ 7 """
8 8
9 import sys, os, re, traceback, signal, time, logging, getpass 9 import sys, os, re, traceback, signal, time, logging, getpass
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 execution_tag = parse_job 82 execution_tag = parse_job
83 host_protection = parser.options.host_protection 83 host_protection = parser.options.host_protection
84 ssh_user = parser.options.ssh_user 84 ssh_user = parser.options.ssh_user
85 ssh_port = parser.options.ssh_port 85 ssh_port = parser.options.ssh_port
86 ssh_pass = parser.options.ssh_pass 86 ssh_pass = parser.options.ssh_pass
87 collect_crashinfo = parser.options.collect_crashinfo 87 collect_crashinfo = parser.options.collect_crashinfo
88 control_filename = parser.options.control_filename 88 control_filename = parser.options.control_filename
89 89
90 # can't be both a client and a server side test 90 # can't be both a client and a server side test
91 if client and server: 91 if client and server:
92 print "Can not specify a test as both server and client!" 92 parser.parser.error("Can not specify a test as both server and client!")
93 sys.exit(1)
94 93
95 if len(parser.args) < 1 and not (verify or repair or cleanup 94 if len(parser.args) < 1 and not (verify or repair or cleanup
96 or collect_crashinfo): 95 or collect_crashinfo):
97 print parser.parser.print_help() 96 parser.parser.error("Missing argument: control file")
98 sys.exit(1)
99 97
100 # We have a control file unless it's just a verify/repair/cleanup job 98 # We have a control file unless it's just a verify/repair/cleanup job
101 if len(parser.args) > 0: 99 if len(parser.args) > 0:
102 control = parser.args[0] 100 control = parser.args[0]
103 else: 101 else:
104 control = None 102 control = None
105 103
106 if machines_file: 104 if machines_file:
107 machines = [] 105 machines = []
108 for m in open(machines_file, 'r').readlines(): 106 for m in open(machines_file, 'r').readlines():
109 # remove comments, spaces 107 # remove comments, spaces
110 m = re.sub('#.*', '', m).strip() 108 m = re.sub('#.*', '', m).strip()
111 if m: 109 if m:
112 machines.append(m) 110 machines.append(m)
113 print "Read list of machines from file: %s" % machines_file 111 print "Read list of machines from file: %s" % machines_file
114 print ','.join(machines) 112 print ','.join(machines)
115 113
116 if machines: 114 if machines:
117 for machine in machines: 115 for machine in machines:
118 if not machine or re.search('\s', machine): 116 if not machine or re.search('\s', machine):
119 print "Invalid machine %s" % str(machine) 117 parser.parser.error("Invalid machine: %s" % str(machine))
120 sys.exit(1)
121 machines = list(set(machines)) 118 machines = list(set(machines))
122 machines.sort() 119 machines.sort()
123 120
124 if group_name and len(machines) < 2: 121 if group_name and len(machines) < 2:
125 print ("-G %r may only be supplied with more than one machine." 122 parser.parser.error("-G %r may only be supplied with more than one machi ne."
126 % group_name) 123 % group_name)
127 sys.exit(1)
128 124
129 kwargs = {'group_name': group_name, 'tag': execution_tag} 125 kwargs = {'group_name': group_name, 'tag': execution_tag}
130 if control_filename: 126 if control_filename:
131 kwargs['control_filename'] = control_filename 127 kwargs['control_filename'] = control_filename
132 job = server_job.server_job(control, parser.args[1:], results, label, 128 job = server_job.server_job(control, parser.args[1:], results, label,
133 user, machines, client, parse_job, 129 user, machines, client, parse_job,
134 ssh_user, ssh_port, ssh_pass, **kwargs) 130 ssh_user, ssh_port, ssh_pass, **kwargs)
135 job.logging.start_logging() 131 job.logging.start_logging()
136 job.init_parser() 132 job.init_parser()
137 133
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 # an 'abort' and return 1. 228 # an 'abort' and return 1.
233 exit_code = 1 229 exit_code = 1
234 finally: 230 finally:
235 if pid_file_manager: 231 if pid_file_manager:
236 pid_file_manager.close_file(exit_code) 232 pid_file_manager.close_file(exit_code)
237 sys.exit(exit_code) 233 sys.exit(exit_code)
238 234
239 235
240 if __name__ == '__main__': 236 if __name__ == '__main__':
241 main() 237 main()
OLDNEW
« cli/job.py ('K') | « scheduler/monitor_db.py ('k') | server/autoserv_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698