#!/usr/bin/python3
import time
import threading
import subprocess
import multiprocessing
from multiprocessing import Pool
# -*- coding: utf-8 -*-
date_dir = '/data/download-decryption/aaa/'
mutex = threading.Lock()
shared_list = []
def upload_url(url):
with mutex:
if url not in shared_list:
shared_list.append(url)
# print("Processed item: {url}")
command = "ossutil64 cp {0}{1} oss://agmjys-v-wjm/{2} >> aliyun.txt".format(date_dir,url,url)
subprocess.call(command, shell=True)
print(command)
def main():
start_time = time.time()
with open(r'/data/download-decryption/aaa/all2.log') as f:
log_list = []
for line in f:
line = line.rstrip("\n")
log_list.append(line)
p = Pool(100)
for url in log_list:
p.apply_async(upload_url, args=(url,))
p.close()
p.join()
if __name__ == "__main__":
main()
end_time = time.time()
print("执行结束",end_time)