Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2007 Gary S Thompson # 4 # Copyright (C) 2008,2012 Edward d'Auvergne # 5 # # 6 # This file is part of the program relax (http://www.nmr-relax.com). # 7 # # 8 # This program is free software: you can redistribute it and/or modify # 9 # it under the terms of the GNU General Public License as published by # 10 # the Free Software Foundation, either version 3 of the License, or # 11 # (at your option) any later version. # 12 # # 13 # This program is distributed in the hope that it will be useful, # 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of # 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 16 # GNU General Public License for more details. # 17 # # 18 # You should have received a copy of the GNU General Public License # 19 # along with this program. If not, see <http://www.gnu.org/licenses/>. # 20 # # 21 ############################################################################### 22 23 # Module docstring. 24 """Module containing the results queue objects.""" 25 26 # Python module imports. 27 import sys 28 import threading 29 import traceback 30 31 # multi module imports. 32 from multi.misc import raise_unimplemented 33 from multi.result_commands import Result_command, Result_exception 34 35 # relax module imports (for Python 3 compatibility - the compat module could be bundled with this package if separate). 36 from lib.compat import queue 37 38 42 43 RESULT_QUEUE_EXIT_COMMAND = Exit_queue_result_command() 44 45 46 59 60 6175 76 7764 super(Immediate_result_queue, self).put(job) 65 try: 66 self.processor.process_result(job) 67 except: 68 traceback.print_exc(file=sys.stdout) 69 # FIXME: this doesn't work because this isn't the main thread so sys.exit fails... 70 self.processor.abort()71 7211280 super(Threaded_result_queue, self).__init__(processor) 81 self.queue = queue.Queue() 82 self.sleep_time = 0.05 83 self.processor = processor 84 self.running = 1 85 # FIXME: syntax error here produces exception but no quit 86 self.thread1 = threading.Thread(target=self.workerThread) 87 self.thread1.setDaemon(1) 88 self.thread1.start()89 90 94 95 99 100102 try: 103 while True: 104 job = self.queue.get() 105 if job == RESULT_QUEUE_EXIT_COMMAND: 106 break 107 self.processor.process_result(job) 108 except: 109 traceback.print_exc(file=sys.stdout) 110 # FIXME: this doesn't work because this isn't the main thread so sys.exit fails... 111 self.processor.abort()
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Jun 8 10:45:15 2024 | http://epydoc.sourceforge.net |