def run(self): """ Service.run() the service executes the following steps until killed - 1. check that parent process is still alive 2. check for a new task from inbox 3. execute the task 4. if the task is succesful, store the result if the task is unsuccesful, store the exception traceback 5. put the task into an outbox 6. continue until receive KillTask() or parent process dies """ try: if isinstance(self.verbose,str): with redirect.output(self.verbose,self.verbose): self.__run__() else: self.__run__() except (KeyboardInterrupt,SystemExit): if self.verbose: sys.stderr.write( '%s: Exiting \n' % name ) raise except: sys.stderr.write( '%s: Unhandled Exception \n' % self.name ) sys.stderr.write( traceback.format_exc() ) sys.stderr.write( '\n' ) sys.stderr.flush() raise
def run(self): """ Service.run() the service executes the following steps until killed - 1. check that parent process is still alive 2. check for a new task from inbox 3. execute the task 4. if the task is succesful, store the result if the task is unsuccesful, store the exception traceback 5. put the task into an outbox 6. continue until receive KillTask() or parent process dies """ try: if isinstance(self.verbose, str): with redirect.output(self.verbose, self.verbose): self.__run__() else: self.__run__() except (KeyboardInterrupt, SystemExit): if self.verbose: sys.stderr.write('%s: Exiting \n' % name) raise except: sys.stderr.write('%s: Unhandled Exception \n' % self.name) sys.stderr.write(traceback.format_exc()) sys.stderr.write('\n') sys.stderr.flush() raise
def start(self): if isinstance(self.verbose,str): with redirect.output(self.verbose,self.verbose): self.__start__() else: self.__start__()