BEG += deltaX
    END += deltaX


#启动线程
for item in t:
    item.setDaemon(True)
    item.start()
#循环处理数据
sum,mstr = TT.pocessDataList(TT.GV_THEAD_COUNT,begURL)
#===================================全部处理完毕,储存至文件======================================
now = datetime.datetime.now()
now.strftime('%Y-%m-%d %H:%M:%S')  
last_data_source = {'sum':sum,'time':now}

TT.savetofile(mstr,'C:\\ktieba\\result.txt')
f = open('C:\\ktieba\\result_add','wb')
pickle.dump(last_data_source, f,2)
f.close()
time2 = time.time()
tc = time2 - time1
print('>>>>>抓取完毕!耗时:',str(tc),'秒\n>>>>>共抓取【',sum,'】条数据\n>>>>>结果已经保存至','C:\\ktieba\\result.txt')
#===================================向服务器回传任务结果======================================
FILESENDCMD = str(TZDS.JOBTRANSFER)+",Ready to send"
s.sendall(FILESENDCMD.encode("utf-8"))  
data=s.recv(1024)  
data = data.decode("utf-8")
print("TaskManager:",data)
print(">>>>>开始上传任务结果文件至TaskManager服务器...")
TZIF.sendFile(s,"C:\\ktieba\\result.txt",CID)
print(">>>>>任务进度文件上传完毕!")
Esempio n. 2
0
    x += 1
    BEG += deltaX
    END += deltaX

#启动线程
for item in t:
    item.setDaemon(True)
    item.start()
#循环处理数据
sum, mstr = TT.pocessDataList(TT.GV_THEAD_COUNT, begURL)
#===================================全部处理完毕,储存至文件======================================
now = datetime.datetime.now()
now.strftime('%Y-%m-%d %H:%M:%S')
last_data_source = {'sum': sum, 'time': now}

TT.savetofile(mstr, 'result.txt')
f = open('result_add', 'wb')
pickle.dump(last_data_source, f, 2)
f.close()
time2 = time.time()
tc = time2 - time1
print('>>>>>Script pocess finished!Total time cost:', str(tc),
      'seconds\n>>>>>with[', sum,
      ']pieces of data in all\n>>>>>result have been save to', 'result.txt')

Title = "Download Success! Finised on " + str(now) + '.'
line1 = "Tieba job created on " + str(
    createdtime
) + " now has been finised!\r\n=========================\r\nSummary\r\n\r\n"
line2 = "\r\nJob Created on: \t" + str(
    createdtime) + '\r\nJob finished on: \t' + str(