1
This commit is contained in:
1 parent
ae349a39d2
commit
5042a4c2e5
1 file changed
+38
-38
+38
-38
@@ -736,49 +736,49 @@ if __name__ == '__main__':
|
||||
resFilePath = '/data/datasets/complate/objs'
|
||||
print("Usage: blender -b -P fill_dm_code.py")
|
||||
|
||||
# 控制进程池的大小
|
||||
pool_size = 2 # 设置最大并发进程数为4(根据需求调整)
|
||||
# # 控制进程池的大小
|
||||
# pool_size = 2 # 设置最大并发进程数为4(根据需求调整)
|
||||
|
||||
# 创建一个进程池
|
||||
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)
|
||||
# # 创建一个进程池
|
||||
# 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:
|
||||
# while True:
|
||||
# try:
|
||||
# #判断队列是否为空
|
||||
# if r.llen('model:foot') == 0:
|
||||
# print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()), '队列为空,10秒后重试')
|
||||
# time.sleep(10)
|
||||
# continue
|
||||
# #不为空,取出队列的第一个值
|
||||
# print_id = r.lpop('model:foot')
|
||||
# if print_id is None:
|
||||
# continue
|
||||
# #判断是否存在相同的值
|
||||
# isHaveAlready = 0
|
||||
# for i in r.lrange('model:foot', 0, -1):
|
||||
# if i == print_id:
|
||||
# isHaveAlready = 1
|
||||
# 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
|
||||
# # 启动进程池,监控队列并并行处理 print_id
|
||||
# process_print_ids(workdir, r, pool_size)
|
||||
|
||||
if len(sys.argv) == 5:
|
||||
print_ids = sys.argv[-1]
|
||||
for print_id in print_ids.split(','):
|
||||
main(workdir, r, print_id)
|
||||
else:
|
||||
while True:
|
||||
try:
|
||||
#判断队列是否为空
|
||||
if r.llen('model:foot') == 0:
|
||||
print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()), '队列为空,10秒后重试')
|
||||
time.sleep(10)
|
||||
continue
|
||||
#不为空,取出队列的第一个值
|
||||
print_id = r.lpop('model:foot')
|
||||
if print_id is None:
|
||||
continue
|
||||
#判断是否存在相同的值
|
||||
isHaveAlready = 0
|
||||
for i in r.lrange('model:foot', 0, -1):
|
||||
if i == print_id:
|
||||
isHaveAlready = 1
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user