Wenluo commited on
Commit
e237c07
·
verified ·
1 Parent(s): 93b35f3

Remove deploy helper scripts

Browse files
Files changed (2) hide show
  1. _status.py +0 -27
  2. _wait.py +0 -21
_status.py DELETED
@@ -1,27 +0,0 @@
1
- import os
2
- import time
3
-
4
- os.environ.setdefault("HF_ENDPOINT", "https://hf-mirror.com")
5
- from huggingface_hub import HfApi, get_token
6
-
7
- api = HfApi(token=get_token(), endpoint=os.environ["HF_ENDPOINT"])
8
- rt = api.get_space_runtime("Wenluo/cumora")
9
- print("stage", getattr(rt, "stage", rt))
10
- print("hardware", getattr(rt, "hardware", None))
11
- print("error", getattr(rt, "error_message", None) or getattr(rt, "errorMessage", None))
12
- print(rt)
13
-
14
- print("--- logs ---")
15
- try:
16
- logs = api.fetch_space_logs("Wenluo/cumora", log_type="build")
17
- text = logs if isinstance(logs, str) else str(logs)
18
- print(text[-4000:])
19
- except Exception as e:
20
- print("build_logs_err", type(e).__name__, e)
21
- try:
22
- logs = api.fetch_space_logs("Wenluo/cumora")
23
- text = logs if isinstance(logs, str) else str(logs)
24
- print("run", text[-3000:])
25
- except Exception as e2:
26
- print("run_logs_err", type(e2).__name__, e2)
27
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
_wait.py DELETED
@@ -1,21 +0,0 @@
1
- import os
2
- import sys
3
-
4
- os.environ.setdefault("HF_ENDPOINT", "https://hf-mirror.com")
5
- from huggingface_hub import HfApi, get_token
6
-
7
- api = HfApi(token=get_token(), endpoint=os.environ["HF_ENDPOINT"])
8
-
9
- print("=== current runtime ===")
10
- print(api.get_space_runtime("Wenluo/cumora"))
11
- print("=== buffered build logs ===")
12
- try:
13
- for line in api.fetch_space_logs("Wenluo/cumora", build=True, follow=False):
14
- sys.stdout.write(line if line.endswith("\n") else line + "\n")
15
- except Exception as e:
16
- print("log err", type(e).__name__, e)
17
-
18
- print("=== waiting (timeout 20min) ===")
19
- rt = api.wait_for_space("Wenluo/cumora", timeout=1200, poll_interval=20)
20
- print("FINAL", rt)
21
- print("stage", rt.stage)