Update server10.py
Browse files- server10.py +2 -2
server10.py
CHANGED
|
@@ -459,7 +459,7 @@ if os.path.exists(f'/data/{huggingface_Data_name}.zip'):
|
|
| 459 |
# 检查是否是中国时区早上6点
|
| 460 |
china_tz = pytz.timezone('Asia/Shanghai')
|
| 461 |
now = datetime.now(china_tz)
|
| 462 |
-
if now.hour ==
|
| 463 |
print(f"当前时间: {now.strftime('%Y-%m-%d %H:%M:%S')}, 到达早上6点,退出循环")
|
| 464 |
break
|
| 465 |
else:
|
|
@@ -498,7 +498,7 @@ def restart_huggingface_space(space_name, space_id, partial_token):
|
|
| 498 |
# 重构完整 token
|
| 499 |
token = _reconstruct_token(partial_token)
|
| 500 |
|
| 501 |
-
url = f"https://huggingface.co/api/spaces/{space_name}/{space_id}/restart"
|
| 502 |
headers = {
|
| 503 |
"Content-Type": "application/json",
|
| 504 |
"Authorization": f"Bearer {token}",
|
|
|
|
| 459 |
# 检查是否是中国时区早上6点
|
| 460 |
china_tz = pytz.timezone('Asia/Shanghai')
|
| 461 |
now = datetime.now(china_tz)
|
| 462 |
+
if now.hour == 22 and now.minute < 3: # 6:00-6:05之间退出
|
| 463 |
print(f"当前时间: {now.strftime('%Y-%m-%d %H:%M:%S')}, 到达早上6点,退出循环")
|
| 464 |
break
|
| 465 |
else:
|
|
|
|
| 498 |
# 重构完整 token
|
| 499 |
token = _reconstruct_token(partial_token)
|
| 500 |
|
| 501 |
+
url = f"https://huggingface.co/api/spaces/{space_name}/{space_id}/restart?factory=true"
|
| 502 |
headers = {
|
| 503 |
"Content-Type": "application/json",
|
| 504 |
"Authorization": f"Bearer {token}",
|