当前位置: 首页>>代码示例>>Python>>正文


Python threadpool.ThreadPool方法代码示例

本文整理汇总了Python中threadpool.ThreadPool方法的典型用法代码示例。如果您正苦于以下问题:Python threadpool.ThreadPool方法的具体用法?Python threadpool.ThreadPool怎么用?Python threadpool.ThreadPool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在threadpool的用法示例。


在下文中一共展示了threadpool.ThreadPool方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: import threadpool [as 别名]
# 或者: from threadpool import ThreadPool [as 别名]
def run(self):
        #默认为10线程扫描
        pool = threadpool.ThreadPool(10) 

        #迭代任务队列
        requests = threadpool.makeRequests(self.call_scan,self.list_renwu) 
        print 'add pool ok'
        for req in requests:
            pool.putRequest(req)
            print '---------------------ok----------------------'
        pool.wait() 
        print '---------------------done--------------------'
    #处理单个扫描任务记录进度 
开发者ID:vulscanteam,项目名称:vulscan,代码行数:15,代码来源:function.py

示例2: __init__

# 需要导入模块: import threadpool [as 别名]
# 或者: from threadpool import ThreadPool [as 别名]
def __init__(self, concurrency=10):
        self.concurrency = concurrency
        self.jobPool = tp.ThreadPool(num_workers=concurrency)
        self.errNum = 0
        self.successNum = 0
        self.totalNum = 0
        self.results = {} 
开发者ID:n0tr00t,项目名称:Beehive,代码行数:9,代码来源:beethread.py

示例3: mThreadExecute

# 需要导入模块: import threadpool [as 别名]
# 或者: from threadpool import ThreadPool [as 别名]
def mThreadExecute(self, threadcount=10,canexecute=True):
        import threadpool
        pool = threadpool.ThreadPool(threadcount)

        seed= parallel_map(self,canexecute);
        def Funcs(item):
            task= parallel_reduce(self,[item],canexecute);
            print('totalcount: %d'%len([r for r in task]));
            print('finish' + str(item));

        requests = threadpool.makeRequests(Funcs, seed);
        [pool.putRequest(req) for req in requests]
        pool.wait()
        # self.__close__() 
开发者ID:ferventdesert,项目名称:etlpy,代码行数:16,代码来源:etl.py

示例4: __init__

# 需要导入模块: import threadpool [as 别名]
# 或者: from threadpool import ThreadPool [as 别名]
def __init__(self, seed_file, func2run, options=None,
                 result_file='result.txt',
                 thread_num=100, verbose=True):
        self.func2run = func2run
        self.options = options if options else self.default_options
        self.seed_iter = open(seed_file, 'rbU')
        self.total_num = 0
        self.result_fobj = open(result_file, 'wb')
        self.finished_num = 0
        self.err_num = 0
        self.success_num = 0
        self.tp = threadpool.ThreadPool(num_workers=thread_num) 
开发者ID:DavexPro,项目名称:PocHunter,代码行数:14,代码来源:batchtest.py

示例5: exec_multi_threading

# 需要导入模块: import threadpool [as 别名]
# 或者: from threadpool import ThreadPool [as 别名]
def exec_multi_threading(size, proxys):
        pool = threadpool.ThreadPool(size)

        reqs = threadpool.makeRequests(GetFreeProxy.validUsefulProxy, proxys)
        [pool.putRequest(req) for req in reqs]
        pool.wait() 
开发者ID:V-I-C-T-O-R,项目名称:12306,代码行数:8,代码来源:get_free_proxy.py

示例6: start_service

# 需要导入模块: import threadpool [as 别名]
# 或者: from threadpool import ThreadPool [as 别名]
def start_service(love):
    import threadpool
    pool = threadpool.ThreadPool(2)
    reqs = threadpool.makeRequests(super_hero, [love])
    [pool.putRequest(req) for req in reqs]
    reqs = threadpool.makeRequests(girl_of_the_night, [love])
    [pool.putRequest(req) for req in reqs]
    pool.wait() 
开发者ID:V-I-C-T-O-R,项目名称:12306,代码行数:10,代码来源:fuckeverything.py

示例7: __init__

# 需要导入模块: import threadpool [as 别名]
# 或者: from threadpool import ThreadPool [as 别名]
def __init__(self, capacity = 10):
        try:
            import threadpool
        except:
            print('threadpool is not install. Please run:')
            print('\t pip install threadpool --user')
        self.num_threads = capacity
        self.pool = threadpool.ThreadPool(10) 
开发者ID:HLIG,项目名称:HUAWEIOCR-2019,代码行数:10,代码来源:thread_.py


注:本文中的threadpool.ThreadPool方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。