コード例 #1
0
ファイル: Service.py プロジェクト: aerialhedgehog/VyPy
 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
コード例 #2
0
ファイル: Service.py プロジェクト: paopaoai11/VyPy
 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
コード例 #3
0
ファイル: MultiTask.py プロジェクト: tristanpaine/SUAVE
 def start(self):
     if isinstance(self.verbose,str):
         with redirect.output(self.verbose,self.verbose):
             self.__start__()
     else:
         self.__start__()