def test(): print('start testing') tp = ThreadPool() for i in range(15): time.sleep(0.1) tp.add_job(test_job, i) t = time.time() tp.wait_for_complete() print('s:'+str(time.time()-t)) print('end testing')
def GetMatchPage(season, league, matches): ''' 获取指定联赛的Match页面 ''' tp = ThreadPool() print('Start updating ' + season + ' ' + league + ' matches...') dirLeague = Global.Dir_Root + season + '\\' + league for matchID in sorted(matches.keys()): urlMatch = matches.get(matchID) tp.add_job(GetPageText, dirLeague, matchID, urlMatch, len(matches)) tp.wait_for_complete() if len(matches) > 0: print('\n' + season + ' ' +league + ' updating complete!\n') else: print(season + ' ' + league + ' updating complete!\n')