computefence 0.2.11__tar.gz → 0.2.12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {computefence-0.2.11 → computefence-0.2.12}/PKG-INFO +1 -1
- computefence-0.2.12/computefence/__init__.py +1 -0
- {computefence-0.2.11 → computefence-0.2.12}/computefence/telemetry.py +56 -2
- {computefence-0.2.11 → computefence-0.2.12}/computefence.egg-info/PKG-INFO +1 -1
- computefence-0.2.11/computefence/__init__.py +0 -1
- {computefence-0.2.11 → computefence-0.2.12}/LICENSE +0 -0
- {computefence-0.2.11 → computefence-0.2.12}/README.md +0 -0
- {computefence-0.2.11 → computefence-0.2.12}/computefence/checks/__init__.py +0 -0
- {computefence-0.2.11 → computefence-0.2.12}/computefence/checks/dataset.py +0 -0
- {computefence-0.2.11 → computefence-0.2.12}/computefence/checks/environment.py +0 -0
- {computefence-0.2.11 → computefence-0.2.12}/computefence/checks/storage.py +0 -0
- {computefence-0.2.11 → computefence-0.2.12}/computefence/cli.py +0 -0
- {computefence-0.2.11 → computefence-0.2.12}/computefence.egg-info/SOURCES.txt +0 -0
- {computefence-0.2.11 → computefence-0.2.12}/computefence.egg-info/dependency_links.txt +0 -0
- {computefence-0.2.11 → computefence-0.2.12}/computefence.egg-info/entry_points.txt +0 -0
- {computefence-0.2.11 → computefence-0.2.12}/computefence.egg-info/requires.txt +0 -0
- {computefence-0.2.11 → computefence-0.2.12}/computefence.egg-info/top_level.txt +0 -0
- {computefence-0.2.11 → computefence-0.2.12}/pyproject.toml +0 -0
- {computefence-0.2.11 → computefence-0.2.12}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: computefence
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.12
|
|
4
4
|
Summary: Don't lose another RunPod checkpoint to ephemeral disk before your job bills.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Keywords: runpod,vast.ai,gpu training,hf_home,cuda,preflight,machine learning,mlops,checkpoint
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.12"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import hashlib
|
|
2
2
|
import os
|
|
3
3
|
import platform
|
|
4
|
+
import subprocess
|
|
4
5
|
import sys
|
|
5
6
|
import threading
|
|
6
7
|
import uuid
|
|
@@ -16,6 +17,57 @@ def _is_opted_out():
|
|
|
16
17
|
return OPT_OUT_FILE.exists()
|
|
17
18
|
|
|
18
19
|
|
|
20
|
+
def get_project_id() -> str:
|
|
21
|
+
# Primary: git remote URL hash — survives pod recreation
|
|
22
|
+
try:
|
|
23
|
+
git_url = subprocess.check_output(
|
|
24
|
+
["git", "config", "--get", "remote.origin.url"],
|
|
25
|
+
stderr=subprocess.DEVNULL
|
|
26
|
+
).decode().strip()
|
|
27
|
+
if git_url:
|
|
28
|
+
return hashlib.sha256(git_url.encode()).hexdigest()[:16]
|
|
29
|
+
except Exception:
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
# Fallback: persistent volume token
|
|
33
|
+
token_path = "/workspace/.computefence_id"
|
|
34
|
+
try:
|
|
35
|
+
if os.path.exists(token_path):
|
|
36
|
+
with open(token_path) as f:
|
|
37
|
+
token = f.read().strip()
|
|
38
|
+
if token:
|
|
39
|
+
return token
|
|
40
|
+
except Exception:
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
# Last resort: ephemeral cwd hash
|
|
44
|
+
return "ephemeral-" + hashlib.sha256(os.getcwd().encode()).hexdigest()[:8]
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def get_execution_mode() -> str:
|
|
48
|
+
if os.environ.get("GITHUB_ACTIONS"):
|
|
49
|
+
return "github-action"
|
|
50
|
+
if os.environ.get("CI"):
|
|
51
|
+
return "ci"
|
|
52
|
+
try:
|
|
53
|
+
ppid = os.getppid()
|
|
54
|
+
result = subprocess.run(
|
|
55
|
+
["ps", "-p", str(ppid), "-o", "comm="],
|
|
56
|
+
capture_output=True, text=True, timeout=2
|
|
57
|
+
)
|
|
58
|
+
parent = result.stdout.strip().lower()
|
|
59
|
+
if "bash" in parent or "sh" in parent:
|
|
60
|
+
cmdline_path = f"/proc/{ppid}/cmdline"
|
|
61
|
+
if os.path.exists(cmdline_path):
|
|
62
|
+
with open(cmdline_path, "rb") as f:
|
|
63
|
+
cmdline = f.read().decode(errors="replace").replace("\x00", " ")
|
|
64
|
+
if "on-start" in cmdline or "startup" in cmdline or "entrypoint" in cmdline:
|
|
65
|
+
return "on-start"
|
|
66
|
+
except Exception:
|
|
67
|
+
pass
|
|
68
|
+
return "manual"
|
|
69
|
+
|
|
70
|
+
|
|
19
71
|
def _send(payload: dict):
|
|
20
72
|
try:
|
|
21
73
|
import requests
|
|
@@ -49,7 +101,6 @@ def record_run(results: list):
|
|
|
49
101
|
gpu_count = torch.cuda.device_count()
|
|
50
102
|
except Exception:
|
|
51
103
|
try:
|
|
52
|
-
import subprocess
|
|
53
104
|
result = subprocess.run(
|
|
54
105
|
["nvidia-smi", "--query-gpu=name", "--format=csv,noheader"],
|
|
55
106
|
capture_output=True, text=True, timeout=5
|
|
@@ -69,8 +120,11 @@ def record_run(results: list):
|
|
|
69
120
|
"blocker_count": blocker_count,
|
|
70
121
|
"pass_count": pass_count,
|
|
71
122
|
"opted_in": True,
|
|
123
|
+
"project_id": get_project_id(),
|
|
124
|
+
"run_id": str(uuid.uuid4()),
|
|
125
|
+
"execution_mode": get_execution_mode(),
|
|
72
126
|
}
|
|
73
127
|
|
|
74
128
|
thread = threading.Thread(target=_send, args=(payload,), daemon=True)
|
|
75
129
|
thread.start()
|
|
76
|
-
thread.join(timeout=4)
|
|
130
|
+
thread.join(timeout=4)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: computefence
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.12
|
|
4
4
|
Summary: Don't lose another RunPod checkpoint to ephemeral disk before your job bills.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Keywords: runpod,vast.ai,gpu training,hf_home,cuda,preflight,machine learning,mlops,checkpoint
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.11"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|