OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import os | |
6 import common | |
7 import utils | |
8 | |
9 | |
10 def get_site_job_data(job): | |
11 """Add custom data to the job keyval info. | |
12 | |
13 When multiple machines are used in a job, change the hostname to | |
14 the platform of the first machine instead of machine1,machine2,... This | |
15 makes the job reports easier to read and keeps the tko_machines table from | |
16 growing too large. | |
17 | |
18 Args: | |
19 job: instance of server_job. | |
20 | |
21 Returns: | |
22 keyval dictionary with new hostname value, or empty dictionary. | |
23 """ | |
24 site_job_data = {} | |
25 # Only modify hostname on multimachine jobs | |
ericli
2011/04/06 20:20:57
add a comment here:
assume all machine in the job
| |
26 if len(job.machines) > 1: | |
27 # Search through machines for first machine with a platform. | |
28 for host in job.machines: | |
29 keyval_path = os.path.join(job.resultdir, 'host_keyvals', host) | |
30 keyvals = utils.read_keyval(keyval_path) | |
31 host_plat = keyvals.get('platform', None) | |
32 if not host_plat: | |
33 continue | |
34 site_job_data['hostname'] = host_plat | |
35 break | |
36 return site_job_data | |
37 | |
38 | |
39 class site_server_job(object): | |
40 pass | |
OLD | NEW |