Update server2.py
Browse files- server2.py +6 -4
server2.py
CHANGED
|
@@ -628,25 +628,27 @@ def SillyTavern():
|
|
| 628 |
os.chdir('/')
|
| 629 |
print(f"kaggle datasets download {huggingface_name}/{huggingface_Data_name}")
|
| 630 |
# os.system(f"kaggle datasets download {huggingface_name}/{huggingface_Data_name}")
|
|
|
|
| 631 |
while True:
|
| 632 |
# 执行下载命令
|
|
|
|
|
|
|
| 633 |
os.system(f"kaggle datasets download {huggingface_name}/{huggingface_Data_name} -p /")
|
| 634 |
# 检查文件是否存在
|
| 635 |
if os.path.exists(f'/{huggingface_Data_name}.zip'):
|
| 636 |
print(f"{huggingface_Data_name}.zip 下载成功!")
|
| 637 |
break # 跳出循环
|
| 638 |
-
|
| 639 |
print(f"{huggingface_Data_name}.zip 下载失败,正在重试...")
|
| 640 |
-
|
| 641 |
-
time.sleep(
|
| 642 |
# os.system('kaggle datasets download xovale7506/sillytavern-data2')
|
| 643 |
# 检查文件是否存在
|
| 644 |
if not os.path.exists(f'/{huggingface_Data_name}.zip'):
|
| 645 |
print(f"文件 /{huggingface_Data_name}.zip 不存在,启用实时同步。")
|
| 646 |
generate_ssh_key()
|
| 647 |
copy_public_key_to_remote(ssh_url, ssh_port, "root", "qilan")
|
|
|
|
| 648 |
# subprocess.run(f"rsync -avz --port=7075 ljj@{frp_url}::qilan {data_folder}/", shell=True, check=True)
|
| 649 |
-
subprocess.run(f"rsync -avz -e 'ssh -p {ssh_port} -o StrictHostKeyChecking=no -o ConnectTimeout=30' --timeout=300 root@{ssh_url}:{data_folder}/ {data_folder}/", shell=True, check=True)
|
| 650 |
# sys.exit()
|
| 651 |
else:
|
| 652 |
|
|
|
|
| 628 |
os.chdir('/')
|
| 629 |
print(f"kaggle datasets download {huggingface_name}/{huggingface_Data_name}")
|
| 630 |
# os.system(f"kaggle datasets download {huggingface_name}/{huggingface_Data_name}")
|
| 631 |
+
download_n = 0
|
| 632 |
while True:
|
| 633 |
# 执行下载命令
|
| 634 |
+
if download_n > 6:
|
| 635 |
+
break
|
| 636 |
os.system(f"kaggle datasets download {huggingface_name}/{huggingface_Data_name} -p /")
|
| 637 |
# 检查文件是否存在
|
| 638 |
if os.path.exists(f'/{huggingface_Data_name}.zip'):
|
| 639 |
print(f"{huggingface_Data_name}.zip 下载成功!")
|
| 640 |
break # 跳出循环
|
|
|
|
| 641 |
print(f"{huggingface_Data_name}.zip 下载失败,正在重试...")
|
| 642 |
+
download_n += 1
|
| 643 |
+
time.sleep(300) # 等待一段时间再重试(例如5秒
|
| 644 |
# os.system('kaggle datasets download xovale7506/sillytavern-data2')
|
| 645 |
# 检查文件是否存在
|
| 646 |
if not os.path.exists(f'/{huggingface_Data_name}.zip'):
|
| 647 |
print(f"文件 /{huggingface_Data_name}.zip 不存在,启用实时同步。")
|
| 648 |
generate_ssh_key()
|
| 649 |
copy_public_key_to_remote(ssh_url, ssh_port, "root", "qilan")
|
| 650 |
+
subprocess.run(f"rsync -avz --timeout=600 -e 'ssh -p {ssh_port} -o StrictHostKeyChecking=no' root@{ssh_url}:{data_folder}/ {data_folder}/",shell=True, check=True)
|
| 651 |
# subprocess.run(f"rsync -avz --port=7075 ljj@{frp_url}::qilan {data_folder}/", shell=True, check=True)
|
|
|
|
| 652 |
# sys.exit()
|
| 653 |
else:
|
| 654 |
|