同步更改数据
This commit is contained in:
1 parent
ecb58b2f59
commit
33ba8bb357
21 files changed
+2019472
-63
No files matched your search
@@ -307,3 +307,27 @@ def diff_time(start_time):
|
||||
m, s = divmod(diff, 60)
|
||||
return f'{int(m)}分{int(s)}秒'
|
||||
|
||||
def down_obj_from_oss_for_fix(workdir, pid, action):
|
||||
if os.path.exists(os.path.join(workdir, action, pid)):
|
||||
print(f'目录{os.path.join(workdir, action, pid)}已存在,跳过')
|
||||
return
|
||||
else:
|
||||
os.makedirs(os.path.join(workdir, action, pid))
|
||||
|
||||
# 根据前缀获取文件列表
|
||||
prefix = f'objs/{action}/{pid}/'
|
||||
filelist = oss2.ObjectIteratorV2(config.oss_bucket, prefix=prefix)
|
||||
print('正在下载:', prefix)
|
||||
obj_filename = ""
|
||||
for file in filelist:
|
||||
filename = file.key.split('/')[-1]
|
||||
if filename.endswith(f'{pid}.obj') == False:
|
||||
continue
|
||||
|
||||
if filename.endswith('.obj'):
|
||||
obj_filename = filename
|
||||
|
||||
# print('正在下载:', file.key)
|
||||
localfile = os.path.join(workdir, action, pid, filename)
|
||||
config.oss_bucket.get_object_to_file(file.key, localfile)
|
||||
return obj_filename
|
||||
Reference in new issue
Block a user