Qilan2 commited on
Commit
9f534ce
·
verified ·
1 Parent(s): 266502f

Update server10v.py

Browse files
Files changed (1) hide show
  1. server10v.py +3 -3
server10v.py CHANGED
@@ -496,6 +496,7 @@ def restart_huggingface_space(space_name, space_id, partial_token):
496
  import psutil
497
 
498
  def check_system_resources():
 
499
  # 获取CPU使用率
500
  cpu_usage = psutil.cpu_percent(interval=1)
501
 
@@ -511,7 +512,7 @@ def check_system_resources():
511
  print(f"内存使用率: {memory_usage}%")
512
  result = restart_huggingface_space(huggingface_user, huggingface_id, huggingface_tokon)
513
  print(result)
514
- time.sleep(6666666)
515
  else:
516
  print("系统资源正常")
517
 
@@ -542,8 +543,7 @@ if os.path.exists(f'/data/{huggingface_Data_name}.zip'):
542
  Service_status = True
543
  frp(configs, True)
544
  threading.Thread(target=monitor_port, daemon=True).start()#检测端口状态
545
- time.sleep(60)
546
- check_system_resources()
547
  # time.sleep(600)
548
  while True:
549
  # 检查是否是中国时区早上6点
 
496
  import psutil
497
 
498
  def check_system_resources():
499
+ time.sleep(120)
500
  # 获取CPU使用率
501
  cpu_usage = psutil.cpu_percent(interval=1)
502
 
 
512
  print(f"内存使用率: {memory_usage}%")
513
  result = restart_huggingface_space(huggingface_user, huggingface_id, huggingface_tokon)
514
  print(result)
515
+ # time.sleep(6666666)
516
  else:
517
  print("系统资源正常")
518
 
 
543
  Service_status = True
544
  frp(configs, True)
545
  threading.Thread(target=monitor_port, daemon=True).start()#检测端口状态
546
+ threading.Thread(target=check_system_resources, daemon=True).start()#检测CPU内存状态
 
547
  # time.sleep(600)
548
  while True:
549
  # 检查是否是中国时区早上6点