Download deploy/node_logs.py from kefuro/Kefuro-30B: direct link, hf CLI and curl.
- Browser
- Download file 724 Bytes
-
https://huggingface.co/kefuro/Kefuro-30B/resolve/main/deploy/node_logs.py
- Command line
-
hf download hf://kefuro/Kefuro-30B/deploy/node_logs.py
-
curl -L -o node_logs.py https://huggingface.co/kefuro/Kefuro-30B/resolve/main/deploy/node_logs.py
724 Bytes
| """Fetch the last N lines of the node container log.""" | |
| import json, os, sys, time, urllib.request | |
| st = json.load(open("deploy/.node.json")); key = os.environ["VAST_API_KEY"] | |
| req = urllib.request.Request(f"https://console.vast.ai/api/v0/instances/request_logs/{st['instance_id']}/", | |
| data=json.dumps({"tail": sys.argv[1] if len(sys.argv) > 1 else "30"}).encode(), method="PUT", | |
| headers={"Authorization": f"Bearer {key}", "Content-Type": "application/json"}) | |
| r = json.load(urllib.request.urlopen(req, timeout=30)); u = r.get("result_url") or r.get("temp_download_url") | |
| for _ in range(6): | |
| time.sleep(5) | |
| try: print(urllib.request.urlopen(u, timeout=30).read().decode()[-2500:]); break | |
| except Exception: pass | |