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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 shutil.copyfile(CLIENT_WRAPPER_CONTROL_FILE, | 535 shutil.copyfile(CLIENT_WRAPPER_CONTROL_FILE, |
536 server_control_file) | 536 server_control_file) |
537 else: | 537 else: |
538 utils.open_write_close(server_control_file, control) | 538 utils.open_write_close(server_control_file, control) |
539 logging.info("Processing control file") | 539 logging.info("Processing control file") |
540 self._execute_code(server_control_file, namespace) | 540 self._execute_code(server_control_file, namespace) |
541 logging.info("Finished processing control file") | 541 logging.info("Finished processing control file") |
542 | 542 |
543 # no error occured, so we don't need to collect crashinfo | 543 # no error occured, so we don't need to collect crashinfo |
544 collect_crashinfo = False | 544 collect_crashinfo = False |
545 except Exception, e: | 545 except: |
546 try: | 546 try: |
547 logging.exception( | 547 logging.exception( |
548 'Exception escaped control file, job aborting:') | 548 'Exception escaped control file, job aborting:') |
549 self.record('INFO', None, None, str(e), | |
550 {'job_abort_reason': str(e)}) | |
551 except: | 549 except: |
552 pass # don't let logging exceptions here interfere | 550 pass # don't let logging exceptions here interfere |
553 raise | 551 raise |
554 finally: | 552 finally: |
555 if temp_control_file_dir: | 553 if temp_control_file_dir: |
556 # Clean up temp directory used for copies of the control files | 554 # Clean up temp directory used for copies of the control files |
557 try: | 555 try: |
558 shutil.rmtree(temp_control_file_dir) | 556 shutil.rmtree(temp_control_file_dir) |
559 except Exception, e: | 557 except Exception, e: |
560 logging.warn('Could not remove temp directory %s: %s', | 558 logging.warn('Could not remove temp directory %s: %s', |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 intervals = self.disabled_warnings.setdefault(warning_type, []) | 1134 intervals = self.disabled_warnings.setdefault(warning_type, []) |
1137 if not intervals or intervals[-1][1] is not None: | 1135 if not intervals or intervals[-1][1] is not None: |
1138 intervals.append((int(current_time_func()), None)) | 1136 intervals.append((int(current_time_func()), None)) |
1139 | 1137 |
1140 | 1138 |
1141 def enable_warnings(self, warning_type, current_time_func=time.time): | 1139 def enable_warnings(self, warning_type, current_time_func=time.time): |
1142 """As of now, enables all further warnings of this type.""" | 1140 """As of now, enables all further warnings of this type.""" |
1143 intervals = self.disabled_warnings.get(warning_type, []) | 1141 intervals = self.disabled_warnings.get(warning_type, []) |
1144 if intervals and intervals[-1][1] is None: | 1142 if intervals and intervals[-1][1] is None: |
1145 intervals[-1] = (intervals[-1][0], int(current_time_func())) | 1143 intervals[-1] = (intervals[-1][0], int(current_time_func())) |
OLD | NEW |