OLD | NEW |
1 #!/usr/bin/python -u | 1 #!/usr/bin/python -u |
2 | 2 |
3 """ | 3 """ |
4 Autotest scheduler | 4 Autotest scheduler |
5 """ | 5 """ |
6 | 6 |
7 | 7 |
8 import common | 8 import common |
9 import datetime, errno, optparse, os, pwd, Queue, re, shutil, signal | 9 import datetime, errno, optparse, os, pwd, Queue, re, shutil, signal |
10 import smtplib, socket, stat, subprocess, sys, tempfile, time, traceback, urllib | 10 import smtplib, socket, stat, subprocess, sys, tempfile, time, traceback, urllib |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 _testing_mode = True | 152 _testing_mode = True |
153 | 153 |
154 server = status_server.StatusServer() | 154 server = status_server.StatusServer() |
155 server.start() | 155 server.start() |
156 | 156 |
157 try: | 157 try: |
158 initialize() | 158 initialize() |
159 dispatcher = Dispatcher() | 159 dispatcher = Dispatcher() |
160 dispatcher.initialize(recover_hosts=options.recover_hosts) | 160 dispatcher.initialize(recover_hosts=options.recover_hosts) |
161 | 161 |
162 while not _shutdown: | 162 while not _shutdown and not server._shutdown_scheduler: |
163 dispatcher.tick() | 163 dispatcher.tick() |
164 time.sleep(scheduler_config.config.tick_pause_sec) | 164 time.sleep(scheduler_config.config.tick_pause_sec) |
165 except: | 165 except: |
166 email_manager.manager.log_stacktrace( | 166 email_manager.manager.log_stacktrace( |
167 "Uncaught exception; terminating monitor_db") | 167 "Uncaught exception; terminating monitor_db") |
168 | 168 |
169 email_manager.manager.send_queued_emails() | 169 email_manager.manager.send_queued_emails() |
170 server.shutdown() | 170 server.shutdown() |
171 _drone_manager.shutdown() | 171 _drone_manager.shutdown() |
172 _db.disconnect() | 172 _db.disconnect() |
(...skipping 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2609 paired_process = self._paired_with_monitor().get_process() | 2609 paired_process = self._paired_with_monitor().get_process() |
2610 _drone_manager.write_lines_to_file( | 2610 _drone_manager.write_lines_to_file( |
2611 failed_file, ['Archiving failed with exit code %s' | 2611 failed_file, ['Archiving failed with exit code %s' |
2612 % self.monitor.exit_code()], | 2612 % self.monitor.exit_code()], |
2613 paired_with_process=paired_process) | 2613 paired_with_process=paired_process) |
2614 self._set_all_statuses(self._final_status()) | 2614 self._set_all_statuses(self._final_status()) |
2615 | 2615 |
2616 | 2616 |
2617 if __name__ == '__main__': | 2617 if __name__ == '__main__': |
2618 main() | 2618 main() |
OLD | NEW |