admin commited on
Commit
dac0f46
·
1 Parent(s): 26e6faf

restart assigns on trigger

Browse files
Files changed (2) hide show
  1. modules/activate.py +3 -0
  2. modules/restart.py +11 -9
modules/activate.py CHANGED
@@ -7,6 +7,7 @@ from datetime import datetime
7
  from huggingface_hub import HfApi
8
  from modules.smtp import send_email
9
  from modules.times import fix_datetime
 
10
  from utils import HF_DOMAIN, HEADER, MS_HEADER, TIMEOUT, MS_DOMAIN, DELAY, USERS
11
 
12
 
@@ -184,6 +185,8 @@ def trigger(users=USERS):
184
  if content:
185
  send_email(content)
186
 
 
 
187
  except Exception as e:
188
  status = f"{e}"
189
 
 
7
  from huggingface_hub import HfApi
8
  from modules.smtp import send_email
9
  from modules.times import fix_datetime
10
+ from modules.restart import restart_repos
11
  from utils import HF_DOMAIN, HEADER, MS_HEADER, TIMEOUT, MS_DOMAIN, DELAY, USERS
12
 
13
 
 
185
  if content:
186
  send_email(content)
187
 
188
+ restart_repos()
189
+
190
  except Exception as e:
191
  status = f"{e}"
192
 
modules/restart.py CHANGED
@@ -1,4 +1,5 @@
1
  import requests
 
2
  from modules.smtp import send_email
3
  from utils import HF_DOMAIN, MS_DOMAIN, HF_HEADER, MS_HEADER, TIMEOUT, REPOS
4
 
@@ -23,18 +24,19 @@ def restart_private_space(repo: str):
23
  return f"\n{response.text}\n"
24
 
25
 
 
 
 
 
 
 
 
 
 
 
26
  def self_restart():
27
  try:
28
- if REPOS:
29
- repos = REPOS.split(";")
30
- for repo in repos:
31
- private_repo = repo.strip()
32
- print(f"Restarting {private_repo}...")
33
- restart_private_studio(private_repo)
34
- restart_private_space(private_repo)
35
-
36
  restart_private_space("kakamond/keeps_alive")
37
-
38
  except Exception as e:
39
  send_email(f"Failed to self-restart: {e}")
40
 
 
1
  import requests
2
+ from tqdm import tqdm
3
  from modules.smtp import send_email
4
  from utils import HF_DOMAIN, MS_DOMAIN, HF_HEADER, MS_HEADER, TIMEOUT, REPOS
5
 
 
24
  return f"\n{response.text}\n"
25
 
26
 
27
+ def restart_repos():
28
+ if REPOS:
29
+ repos = REPOS.split(";")
30
+ for repo in tqdm(repos, desc="Restarting repos"):
31
+ private_repo = repo.strip()
32
+ print(f"Restarting {private_repo}...")
33
+ restart_private_studio(private_repo)
34
+ restart_private_space(private_repo)
35
+
36
+
37
  def self_restart():
38
  try:
 
 
 
 
 
 
 
 
39
  restart_private_space("kakamond/keeps_alive")
 
40
  except Exception as e:
41
  send_email(f"Failed to self-restart: {e}")
42