code: def execute(self, task):
          
  
          taskid = str(task)
          res = None
          try:
              # Try to run the task.  If we catch an exception, then
              # it becomes the result.
              self.time_start = time.time()
              self.setstatus('executing %s' % taskid)
  
              self.logger.debug("now executing task '%s'" % taskid)
              try:
                  res = task.execute()
  
              except UserTaskException as e:
                  res = e
  
              except Exception as e:
                  self.logger.error("Task '%s' raised exception: %s" %
                                    (str(task), str(e)))
                  res = e
                  try:
                      (type, value, tb) = sys.exc_info()
                      self.logger.debug("Traceback:\n%s" %
                                        "".join(traceback.format_tb(tb)))
  
                      # NOTE: to avoid creating a cycle that might cause
                      # problems for GC--see Python library doc for sys
                      # module
                      tb = None
  
                  except Exception as e:
                      self.logger.debug("Traceback information unavailable.")
  
          finally:
              self.logger.debug("done executing task '%s'" % str(task))
  
              self.setstatus('cleaning %s' % taskid)
              # Wake up waiters on other threads
              task.done(res, noraise=True)
  
              self.time_start = 0.0
              self.setstatus('idle')
docs: Execute a task.