jambu-gpu 0.1.0__py3-none-any.whl
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.
- jambu_gpu/__init__.py +5 -0
- jambu_gpu/__main__.py +4 -0
- jambu_gpu/cli/__init__.py +0 -0
- jambu_gpu/cli/_common.py +117 -0
- jambu_gpu/cli/inspect.py +207 -0
- jambu_gpu/cli/lifecycle.py +127 -0
- jambu_gpu/cli/main.py +103 -0
- jambu_gpu/cli/providers.py +96 -0
- jambu_gpu/cli/run.py +37 -0
- jambu_gpu/cli/setup.py +165 -0
- jambu_gpu/cli/status.py +214 -0
- jambu_gpu/cli/validate.py +57 -0
- jambu_gpu/core/__init__.py +0 -0
- jambu_gpu/core/beacon.py +124 -0
- jambu_gpu/core/config.py +596 -0
- jambu_gpu/core/credentials.py +75 -0
- jambu_gpu/core/durations.py +47 -0
- jambu_gpu/core/engine.py +951 -0
- jambu_gpu/core/errors.py +68 -0
- jambu_gpu/core/events.py +115 -0
- jambu_gpu/core/execution.py +169 -0
- jambu_gpu/core/health.py +62 -0
- jambu_gpu/core/model_inspect.py +368 -0
- jambu_gpu/core/models.py +283 -0
- jambu_gpu/core/policy.py +233 -0
- jambu_gpu/core/state.py +361 -0
- jambu_gpu/core/tool_parsers.py +63 -0
- jambu_gpu/providers/__init__.py +4 -0
- jambu_gpu/providers/base.py +125 -0
- jambu_gpu/providers/registry.py +63 -0
- jambu_gpu/providers/vast/__init__.py +3 -0
- jambu_gpu/providers/vast/client.py +230 -0
- jambu_gpu/providers/vast/config.py +51 -0
- jambu_gpu/providers/vast/mapper.py +221 -0
- jambu_gpu/providers/vast/provider.py +422 -0
- jambu_gpu/runtime/__init__.py +6 -0
- jambu_gpu/runtime/base.py +99 -0
- jambu_gpu/runtime/vllm.py +224 -0
- jambu_gpu/watchdog/__init__.py +3 -0
- jambu_gpu/watchdog/agent_body.py +547 -0
- jambu_gpu/watchdog/builder.py +178 -0
- jambu_gpu-0.1.0.dist-info/METADATA +82 -0
- jambu_gpu-0.1.0.dist-info/RECORD +46 -0
- jambu_gpu-0.1.0.dist-info/WHEEL +4 -0
- jambu_gpu-0.1.0.dist-info/entry_points.txt +2 -0
- jambu_gpu-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""Duration parsing/formatting shared by config and CLI flags."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import re
|
|
6
|
+
|
|
7
|
+
_UNITS = {"s": 1, "m": 60, "h": 3600, "d": 86400, "w": 604800}
|
|
8
|
+
_TOKEN = re.compile(r"(\d+(?:\.\d+)?)\s*([smhdw])", re.IGNORECASE)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def parse_duration(value: "str | int | float | None") -> "float | None":
|
|
12
|
+
"""Parse ``6h``, ``15m``, ``1h30m``, ``90`` (seconds) into seconds.
|
|
13
|
+
|
|
14
|
+
``None`` and the literal strings ``none``/``never``/``off`` mean "no limit".
|
|
15
|
+
"""
|
|
16
|
+
if value is None:
|
|
17
|
+
return None
|
|
18
|
+
if isinstance(value, (int, float)):
|
|
19
|
+
return float(value)
|
|
20
|
+
|
|
21
|
+
text = str(value).strip().lower()
|
|
22
|
+
if not text or text in {"none", "never", "off", "unlimited", "0s"}:
|
|
23
|
+
return None
|
|
24
|
+
if re.fullmatch(r"\d+(\.\d+)?", text):
|
|
25
|
+
return float(text)
|
|
26
|
+
|
|
27
|
+
matches = _TOKEN.findall(text)
|
|
28
|
+
if not matches or "".join(f"{n}{u}" for n, u in matches).replace(" ", "") != text.replace(" ", ""):
|
|
29
|
+
raise ValueError(f"invalid duration: {value!r} (expected e.g. 30s, 15m, 6h, 1h30m)")
|
|
30
|
+
return float(sum(float(n) * _UNITS[u.lower()] for n, u in matches))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def format_duration(seconds: "float | None") -> str:
|
|
34
|
+
"""Render seconds as a compact human string (``1h30m``)."""
|
|
35
|
+
if seconds is None:
|
|
36
|
+
return "-"
|
|
37
|
+
seconds = int(max(0, round(seconds)))
|
|
38
|
+
if seconds < 60:
|
|
39
|
+
return f"{seconds}s"
|
|
40
|
+
parts: list[str] = []
|
|
41
|
+
for unit, size in (("d", 86400), ("h", 3600), ("m", 60), ("s", 1)):
|
|
42
|
+
if seconds >= size:
|
|
43
|
+
amount, seconds = divmod(seconds, size)
|
|
44
|
+
parts.append(f"{amount}{unit}")
|
|
45
|
+
if len(parts) == 2:
|
|
46
|
+
break
|
|
47
|
+
return "".join(parts)
|