|
|
|
@ -736,49 +736,49 @@ if __name__ == '__main__': |
|
|
|
resFilePath = '/data/datasets/complate/objs' |
|
|
|
resFilePath = '/data/datasets/complate/objs' |
|
|
|
print("Usage: blender -b -P fill_dm_code.py") |
|
|
|
print("Usage: blender -b -P fill_dm_code.py") |
|
|
|
|
|
|
|
|
|
|
|
# 控制进程池的大小 |
|
|
|
# # 控制进程池的大小 |
|
|
|
pool_size = 2 # 设置最大并发进程数为4(根据需求调整) |
|
|
|
# pool_size = 2 # 设置最大并发进程数为4(根据需求调整) |
|
|
|
|
|
|
|
|
|
|
|
# 创建一个进程池 |
|
|
|
# # 创建一个进程池 |
|
|
|
pool = multiprocessing.Pool(processes=pool_size) |
|
|
|
# pool = multiprocessing.Pool(processes=pool_size) |
|
|
|
|
|
|
|
|
|
|
|
# 如果传递了参数,则处理特定的 print_ids |
|
|
|
|
|
|
|
if len(sys.argv) == 5: |
|
|
|
|
|
|
|
print_ids = sys.argv[-1] |
|
|
|
|
|
|
|
for print_id in print_ids.split(','): |
|
|
|
|
|
|
|
main(workdir, r, print_id) |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
# 启动进程池,监控队列并并行处理 print_id |
|
|
|
|
|
|
|
process_print_ids(workdir, r, pool_size) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# # 如果传递了参数,则处理特定的 print_ids |
|
|
|
# if len(sys.argv) == 5: |
|
|
|
# if len(sys.argv) == 5: |
|
|
|
# print_ids = sys.argv[-1] |
|
|
|
# print_ids = sys.argv[-1] |
|
|
|
# for print_id in print_ids.split(','): |
|
|
|
# for print_id in print_ids.split(','): |
|
|
|
# main(workdir, r, print_id) |
|
|
|
# main(workdir, r, print_id) |
|
|
|
# else: |
|
|
|
# else: |
|
|
|
# while True: |
|
|
|
# # 启动进程池,监控队列并并行处理 print_id |
|
|
|
# try: |
|
|
|
# process_print_ids(workdir, r, pool_size) |
|
|
|
# #判断队列是否为空 |
|
|
|
|
|
|
|
# if r.llen('model:foot') == 0: |
|
|
|
if len(sys.argv) == 5: |
|
|
|
# print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()), '队列为空,10秒后重试') |
|
|
|
print_ids = sys.argv[-1] |
|
|
|
# time.sleep(10) |
|
|
|
for print_id in print_ids.split(','): |
|
|
|
# continue |
|
|
|
main(workdir, r, print_id) |
|
|
|
# #不为空,取出队列的第一个值 |
|
|
|
else: |
|
|
|
# print_id = r.lpop('model:foot') |
|
|
|
while True: |
|
|
|
# if print_id is None: |
|
|
|
try: |
|
|
|
# continue |
|
|
|
#判断队列是否为空 |
|
|
|
# #判断是否存在相同的值 |
|
|
|
if r.llen('model:foot') == 0: |
|
|
|
# isHaveAlready = 0 |
|
|
|
print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()), '队列为空,10秒后重试') |
|
|
|
# for i in r.lrange('model:foot', 0, -1): |
|
|
|
time.sleep(10) |
|
|
|
# if i == print_id: |
|
|
|
continue |
|
|
|
# isHaveAlready = 1 |
|
|
|
#不为空,取出队列的第一个值 |
|
|
|
# break |
|
|
|
print_id = r.lpop('model:foot') |
|
|
|
# if isHaveAlready == 1: |
|
|
|
if print_id is None: |
|
|
|
# continue |
|
|
|
continue |
|
|
|
# #如果是唯一值, 则调用main函数 |
|
|
|
#判断是否存在相同的值 |
|
|
|
# main(workdir, r, print_id) |
|
|
|
isHaveAlready = 0 |
|
|
|
# except Exception as e: |
|
|
|
for i in r.lrange('model:foot', 0, -1): |
|
|
|
# print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()), '出现异常错误,5秒后重试',e) |
|
|
|
if i == print_id: |
|
|
|
# r = create_redis_connection() |
|
|
|
isHaveAlready = 1 |
|
|
|
# continue |
|
|
|
break |
|
|
|
|
|
|
|
if isHaveAlready == 1: |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
#如果是唯一值, 则调用main函数 |
|
|
|
|
|
|
|
main(workdir, r, print_id) |
|
|
|
|
|
|
|
except Exception as e: |
|
|
|
|
|
|
|
print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()), '出现异常错误,5秒后重试',e) |
|
|
|
|
|
|
|
r = create_redis_connection() |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
|
|
|
|
|