Ejemplo n.º 1
0
def getcommand(url_list_result):
    command = ''
    isdir = False
    if len(url_list_result) == 1 and url_list_result[0]['isdir']:
        ssid, command = getDirCommand(url_list_result)
        isdir = True
    else:
        command = getUrlCommand(url_list_result)
        isdir = False
    return isdir, command
Ejemplo n.º 2
0
 def retry(self, dev, urls):
     logger.debug("do retry dev: %s , urlList_len:%s " %
                  (dev.get("host"), len(urls)))
     for i in range(3):
         if urls[0].get("'isdir"):
             session_id, command = postal.getDirCommand(urls)
         else:
             command = postal.getUrlCommand(urls)
         results, wrongRet = postal.doSend_HTTP([{
             "host": dev.get("host")
         }], command)
         if results:
             logger.debug("%s retry finished! , urlList_len:%s " %
                          (dev.get("host"), len(urls)))
             return {}
     return {dev.get("name"): urls}
Ejemplo n.º 3
0
def retry_task(db, query_db):
    global error_tasks, count, mutex
    while count < len(error_tasks):
        mutex.acquire()
        task = error_tasks[count]
        count = count + 1
        # 释放锁
        mutex.release()
        threadname = threading.currentThread().getName()
        logger.debug("threadname:[ %s ] -- error_tasks retry [%s/%s]" %
                     (threadname, count, len(error_tasks)))
        if task.get('urls')[0].get('isdir'):
            session_id, command = postal.getDirCommand(task.get('urls'))
        else:
            command = postal.getUrlCommand(task.get('urls'))
        logger.debug("HOST %s , task retryCount:%s" %
                     (task.get('host'), task.get('retryCount', 0)))
        results, wrongRet = postal.doSend_HTTP([{
            "host": task.get('host')
        }], command)
        update_error_task(task, results, db, query_db)
Ejemplo n.º 4
0
from __init__ import *