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 | 9 import getpass, os, sys, re, stat, tempfile, time, select, subprocess |
10 import traceback, shutil, warnings, fcntl, pickle, logging, itertools, errno | 10 import traceback, shutil, warnings, fcntl, pickle, logging, itertools, errno |
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 _import_names('autotest_lib.client.common_lib.error') | 978 _import_names('autotest_lib.client.common_lib.error') |
979 _import_names('autotest_lib.client.common_lib.barrier', ('barrier',)) | 979 _import_names('autotest_lib.client.common_lib.barrier', ('barrier',)) |
980 | 980 |
981 # Inject ourself as the job object into other classes within the API. | 981 # Inject ourself as the job object into other classes within the API. |
982 # (Yuck, this injection is a gross thing be part of a public API. -gps) | 982 # (Yuck, this injection is a gross thing be part of a public API. -gps) |
983 # | 983 # |
984 # XXX Base & SiteAutotest do not appear to use .job. Who does? | 984 # XXX Base & SiteAutotest do not appear to use .job. Who does? |
985 namespace['autotest'].Autotest.job = self | 985 namespace['autotest'].Autotest.job = self |
986 # server.hosts.base_classes.Host uses .job. | 986 # server.hosts.base_classes.Host uses .job. |
987 namespace['hosts'].Host.job = self | 987 namespace['hosts'].Host.job = self |
| 988 namespace['hosts'].factory.ssh_user = self._ssh_user |
| 989 namespace['hosts'].factory.ssh_port = self._ssh_port |
| 990 namespace['hosts'].factory.ssh_pass = self._ssh_pass |
988 | 991 |
989 | 992 |
990 def _execute_code(self, code_file, namespace, protect=True): | 993 def _execute_code(self, code_file, namespace, protect=True): |
991 """ | 994 """ |
992 Execute code using a copy of namespace as a server control script. | 995 Execute code using a copy of namespace as a server control script. |
993 | 996 |
994 Unless protect_namespace is explicitly set to False, the dict will not | 997 Unless protect_namespace is explicitly set to False, the dict will not |
995 be modified. | 998 be modified. |
996 | 999 |
997 Args: | 1000 Args: |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 intervals = self.disabled_warnings.setdefault(warning_type, []) | 1139 intervals = self.disabled_warnings.setdefault(warning_type, []) |
1137 if not intervals or intervals[-1][1] is not None: | 1140 if not intervals or intervals[-1][1] is not None: |
1138 intervals.append((int(current_time_func()), None)) | 1141 intervals.append((int(current_time_func()), None)) |
1139 | 1142 |
1140 | 1143 |
1141 def enable_warnings(self, warning_type, current_time_func=time.time): | 1144 def enable_warnings(self, warning_type, current_time_func=time.time): |
1142 """As of now, enables all further warnings of this type.""" | 1145 """As of now, enables all further warnings of this type.""" |
1143 intervals = self.disabled_warnings.get(warning_type, []) | 1146 intervals = self.disabled_warnings.get(warning_type, []) |
1144 if intervals and intervals[-1][1] is None: | 1147 if intervals and intervals[-1][1] is None: |
1145 intervals[-1] = (intervals[-1][0], int(current_time_func())) | 1148 intervals[-1] = (intervals[-1][0], int(current_time_func())) |
OLD | NEW |