Пример #1
0
    def _cancelTraversalFolder(self, arg):
        sid = WebFunc.checkId(arg, self.traversalMap)
        try:
            traversalMapEntry = self.traversalMap[sid]
            traversalInfo = traversalMapEntry['info']
            traversalInfo['finished'] = 1

            del self.traversalMap[sid]
            ProfileFunc.delTraversalCacheDB(sid)
            Log.info('Cancel Traversal Folder!!!!')
        except Exception, e:
            Log.exception("Cancel Traversal Folder Failed! Reason[%s]" % e)
            raise cherrypy.HTTPError(462, 'Operation Failed')
 def checkStatus(self, id):
     while True:
         time.sleep(5)
         lastTime = self.traversalInfo['lastTime']
         curTime = int(time.time())
         durTime = curTime - lastTime
         if self.traversalInfo['finished'] == 1:
             break
         if durTime >= TIMEOUT:
             Log.error('...lastTime = %d, durTime = %d' %
                       (lastTime, durTime))
             if self.traversalInfo['finished'] == 0:
                 self.traversakMap[id]['finished'] = 1
                 del self.traversakMap[id]
                 ProfileFunc.delTraversalCacheDB(id)
                 break
             else:
                 Log.debug('check status finished!!!!')
                 break