| OLD | NEW |
| 1 import os, copy, logging, errno, fcntl, time, re, weakref, traceback | 1 import os, copy, logging, errno, fcntl, time, re, weakref, traceback |
| 2 import tarfile | 2 import tarfile |
| 3 import cPickle as pickle | 3 import cPickle as pickle |
| 4 from autotest_lib.client.common_lib import autotemp, error, log | 4 from autotest_lib.client.common_lib import autotemp, error, log |
| 5 | 5 |
| 6 | 6 |
| 7 class job_directory(object): | 7 class job_directory(object): |
| 8 """Represents a job.*dir directory.""" | 8 """Represents a job.*dir directory.""" |
| 9 | 9 |
| 10 | 10 |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 self.message = message_lines[0].replace('\t', ' ' * 8) | 462 self.message = message_lines[0].replace('\t', ' ' * 8) |
| 463 self.extra_message_lines = message_lines[1:] | 463 self.extra_message_lines = message_lines[1:] |
| 464 if self.BAD_CHAR_REGEX.search(self.message): | 464 if self.BAD_CHAR_REGEX.search(self.message): |
| 465 raise ValueError('Invalid character in message %r' % self.message) | 465 raise ValueError('Invalid character in message %r' % self.message) |
| 466 | 466 |
| 467 if not fields: | 467 if not fields: |
| 468 self.fields = {} | 468 self.fields = {} |
| 469 else: | 469 else: |
| 470 self.fields = fields.copy() | 470 self.fields = fields.copy() |
| 471 for key, value in self.fields.iteritems(): | 471 for key, value in self.fields.iteritems(): |
| 472 if type(value) is int: |
| 473 value = str(value) |
| 472 if self.BAD_CHAR_REGEX.search(key + value): | 474 if self.BAD_CHAR_REGEX.search(key + value): |
| 473 raise ValueError('Invalid character in %r=%r field' | 475 raise ValueError('Invalid character in %r=%r field' |
| 474 % (key, value)) | 476 % (key, value)) |
| 475 | 477 |
| 476 # build up the timestamp | 478 # build up the timestamp |
| 477 if timestamp is None: | 479 if timestamp is None: |
| 478 timestamp = int(time.time()) | 480 timestamp = int(time.time()) |
| 479 self.fields[self.TIMESTAMP_FIELD] = str(timestamp) | 481 self.fields[self.TIMESTAMP_FIELD] = str(timestamp) |
| 480 self.fields[self.LOCALTIME_FIELD] = time.strftime( | 482 self.fields[self.LOCALTIME_FIELD] = time.strftime( |
| 481 '%b %d %H:%M:%S', time.localtime(timestamp)) | 483 '%b %d %H:%M:%S', time.localtime(timestamp)) |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 """Record a job-level status event, using a status_log_entry. | 1199 """Record a job-level status event, using a status_log_entry. |
| 1198 | 1200 |
| 1199 This is the same as self.record but using an existing status log | 1201 This is the same as self.record but using an existing status log |
| 1200 entry object rather than constructing one for you. | 1202 entry object rather than constructing one for you. |
| 1201 | 1203 |
| 1202 @param entry: A status_log_entry object | 1204 @param entry: A status_log_entry object |
| 1203 @param log_in_subdir: A boolean that indicates (when true) that subdir | 1205 @param log_in_subdir: A boolean that indicates (when true) that subdir |
| 1204 logs should be written into the subdirectory status log file. | 1206 logs should be written into the subdirectory status log file. |
| 1205 """ | 1207 """ |
| 1206 self._get_status_logger().record_entry(entry, log_in_subdir) | 1208 self._get_status_logger().record_entry(entry, log_in_subdir) |
| OLD | NEW |