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. # 7 # # 8 # relax 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 2 of the License, or # 11 # (at your option) any later version. # 12 # # 13 # relax 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 relax; if not, write to the Free Software # 20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # 21 # # 22 ############################################################################### 23 24 # Module docstring. 25 """Module containing the results queue objects.""" 26 27 # Python module imports. 28 import Queue 29 import sys 30 import threading 31 import traceback 32 33 # multi module imports. 34 from multi.misc import raise_unimplemented 35 from multi.result_commands import Result_command, Result_exception 36 37 41 42 RESULT_QUEUE_EXIT_COMMAND = Exit_queue_result_command() 43 44 45 58 59 6074 75 7663 super(Immediate_result_queue, self).put(job) 64 try: 65 self.processor.process_result(job) 66 except: 67 traceback.print_exc(file=sys.stdout) 68 # FIXME: this doesn't work because this isn't the main thread so sys.exit fails... 69 self.processor.abort()70 7111179 super(Threaded_result_queue, self).__init__(processor) 80 self.queue = Queue.Queue() 81 self.sleep_time = 0.05 82 self.processor = processor 83 self.running = 1 84 # FIXME: syntax error here produces exception but no quit 85 self.thread1 = threading.Thread(target=self.workerThread) 86 self.thread1.setDaemon(1) 87 self.thread1.start()88 89 93 94 98 99101 try: 102 while True: 103 job = self.queue.get() 104 if job == RESULT_QUEUE_EXIT_COMMAND: 105 break 106 self.processor.process_result(job) 107 except: 108 traceback.print_exc(file=sys.stdout) 109 # FIXME: this doesn't work because this isn't the main thread so sys.exit fails... 110 self.processor.abort()
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Apr 10 14:17:04 2013 | http://epydoc.sourceforge.net |