Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 """ | 1 """ |
| 2 The main job wrapper for the server side. | 2 The main job wrapper for the server side. |
| 3 | 3 |
| 4 This is the core infrastructure. Derived from the client side job.py | 4 This is the core infrastructure. Derived from the client side job.py |
| 5 | 5 |
| 6 Copyright Martin J. Bligh, Andy Whitcroft 2007 | 6 Copyright Martin J. Bligh, Andy Whitcroft 2007 |
| 7 """ | 7 """ |
| 8 | 8 |
| 9 import getpass, os, sys, re, stat, tempfile, time, select, subprocess, platform | 9 import getpass, os, sys, re, stat, tempfile, time, select, subprocess, platform |
| 10 import traceback, shutil, warnings, fcntl, pickle, logging, itertools, errno | 10 import traceback, shutil, warnings, fcntl, pickle, logging, itertools, errno |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 CLIENT_WRAPPER_CONTROL_FILE = _control_segment_path('client_wrapper') | 30 CLIENT_WRAPPER_CONTROL_FILE = _control_segment_path('client_wrapper') |
| 31 CRASHDUMPS_CONTROL_FILE = _control_segment_path('crashdumps') | 31 CRASHDUMPS_CONTROL_FILE = _control_segment_path('crashdumps') |
| 32 CRASHINFO_CONTROL_FILE = _control_segment_path('crashinfo') | 32 CRASHINFO_CONTROL_FILE = _control_segment_path('crashinfo') |
| 33 INSTALL_CONTROL_FILE = _control_segment_path('install') | 33 INSTALL_CONTROL_FILE = _control_segment_path('install') |
| 34 CLEANUP_CONTROL_FILE = _control_segment_path('cleanup') | 34 CLEANUP_CONTROL_FILE = _control_segment_path('cleanup') |
| 35 | 35 |
| 36 VERIFY_CONTROL_FILE = _control_segment_path('verify') | 36 VERIFY_CONTROL_FILE = _control_segment_path('verify') |
| 37 REPAIR_CONTROL_FILE = _control_segment_path('repair') | 37 REPAIR_CONTROL_FILE = _control_segment_path('repair') |
| 38 | 38 |
| 39 | 39 |
| 40 # by default provide a stub that generates no site data | |
| 41 def _get_site_job_data_dummy(job): | |
| 42 return {} | |
| 43 | |
| 44 | |
| 45 # load up site-specific code for generating site-specific job data | |
| 46 get_site_job_data = utils.import_site_function(__file__, | |
| 47 "autotest_lib.server.site_server_job", "get_site_job_data", | |
| 48 _get_site_job_data_dummy) | |
| 49 | |
| 50 | |
| 51 class status_indenter(base_job.status_indenter): | 40 class status_indenter(base_job.status_indenter): |
| 52 """Provide a simple integer-backed status indenter.""" | 41 """Provide a simple integer-backed status indenter.""" |
| 53 def __init__(self): | 42 def __init__(self): |
| 54 self._indent = 0 | 43 self._indent = 0 |
| 55 | 44 |
| 56 | 45 |
| 57 @property | 46 @property |
| 58 def indent(self): | 47 def indent(self): |
| 59 return self._indent | 48 return self._indent |
| 60 | 49 |
| (...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1101 self._state.discard_namespace('client') | 1090 self._state.discard_namespace('client') |
| 1102 | 1091 |
| 1103 | 1092 |
| 1104 def clear_all_known_hosts(self): | 1093 def clear_all_known_hosts(self): |
| 1105 """Clears known hosts files for all AbstractSSHHosts.""" | 1094 """Clears known hosts files for all AbstractSSHHosts.""" |
| 1106 for host in self.hosts: | 1095 for host in self.hosts: |
| 1107 if isinstance(host, abstract_ssh.AbstractSSHHost): | 1096 if isinstance(host, abstract_ssh.AbstractSSHHost): |
| 1108 host.clear_known_hosts() | 1097 host.clear_known_hosts() |
| 1109 | 1098 |
| 1110 | 1099 |
| 1100 # by default provide a stub that generates no site data | |
|
kmixter1
2011/02/23 02:00:39
was this just moved? Were you just moving it to g
thieule
2011/03/03 01:27:41
This block needed to be moved down because it impo
| |
| 1101 def _get_site_job_data_dummy(job): | |
| 1102 return {} | |
| 1103 | |
| 1104 | |
| 1105 # load up site-specific code for generating site-specific job data | |
| 1106 get_site_job_data = utils.import_site_function(__file__, | |
| 1107 "autotest_lib.server.site_server_job", "get_site_job_data", | |
| 1108 _get_site_job_data_dummy) | |
| 1109 | |
| 1110 | |
| 1111 site_server_job = utils.import_site_class( | 1111 site_server_job = utils.import_site_class( |
| 1112 __file__, "autotest_lib.server.site_server_job", "site_server_job", | 1112 __file__, "autotest_lib.server.site_server_job", "site_server_job", |
| 1113 base_server_job) | 1113 base_server_job) |
| 1114 | 1114 |
| 1115 class server_job(site_server_job): | 1115 class server_job(site_server_job): |
| 1116 pass | 1116 pass |
| 1117 | 1117 |
| 1118 | 1118 |
| 1119 class warning_manager(object): | 1119 class warning_manager(object): |
| 1120 """Class for controlling warning logs. Manages the enabling and disabling | 1120 """Class for controlling warning logs. Manages the enabling and disabling |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 1140 intervals = self.disabled_warnings.setdefault(warning_type, []) | 1140 intervals = self.disabled_warnings.setdefault(warning_type, []) |
| 1141 if not intervals or intervals[-1][1] is not None: | 1141 if not intervals or intervals[-1][1] is not None: |
| 1142 intervals.append((int(current_time_func()), None)) | 1142 intervals.append((int(current_time_func()), None)) |
| 1143 | 1143 |
| 1144 | 1144 |
| 1145 def enable_warnings(self, warning_type, current_time_func=time.time): | 1145 def enable_warnings(self, warning_type, current_time_func=time.time): |
| 1146 """As of now, enables all further warnings of this type.""" | 1146 """As of now, enables all further warnings of this type.""" |
| 1147 intervals = self.disabled_warnings.get(warning_type, []) | 1147 intervals = self.disabled_warnings.get(warning_type, []) |
| 1148 if intervals and intervals[-1][1] is None: | 1148 if intervals and intervals[-1][1] is None: |
| 1149 intervals[-1] = (intervals[-1][0], int(current_time_func())) | 1149 intervals[-1] = (intervals[-1][0], int(current_time_func())) |
| OLD | NEW |