Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2007 Gary S Thompson (https://gna.org/users/varioustoxins) # 4 # Copyright (C) 2011-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 try: 28 import queue 29 except ImportError: 30 import Queue as queue 31 import sys 32 import threading 33 import traceback 34 35 # multi module imports. 36 from multi.misc import raise_unimplemented 37 from multi.result_commands import Result_command, Result_exception 38 39 43 44 RESULT_QUEUE_EXIT_COMMAND = Exit_queue_result_command() 45 46 47 60 61 6276 77 7865 super(Immediate_result_queue, self).put(job) 66 try: 67 self.processor.process_result(job) 68 except: 69 traceback.print_exc(file=sys.stdout) 70 # FIXME: this doesn't work because this isn't the main thread so sys.exit fails... 71 self.processor.abort()72 7311381 super(Threaded_result_queue, self).__init__(processor) 82 self.queue = Queue.Queue() 83 self.sleep_time = 0.05 84 self.processor = processor 85 self.running = 1 86 # FIXME: syntax error here produces exception but no quit 87 self.thread1 = threading.Thread(target=self.workerThread) 88 self.thread1.setDaemon(1) 89 self.thread1.start()90 91 95 96 100 101103 try: 104 while True: 105 job = self.queue.get() 106 if job == RESULT_QUEUE_EXIT_COMMAND: 107 break 108 self.processor.process_result(job) 109 except: 110 traceback.print_exc(file=sys.stdout) 111 # FIXME: this doesn't work because this isn't the main thread so sys.exit fails... 112 self.processor.abort()
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Apr 10 14:40:45 2013 | http://epydoc.sourceforge.net |