Zeitplan: exklusive Nutzung, Modellzeitfenster, Super-Keys und Zeiten über Mitternacht
- Pins, exklusive Nutzung und Modellzeitfenster liegen in einem gemeinsamen Zeitplan (Tabelle schedule; bestehende Pins werden übernommen) und werden mit omega-proxy schedule pin|exclusive|window|list|remove verwaltet - Exklusiv: nur die genannten Keys dürfen das System nutzen; Modellzeitfenster: nur die genannten Modelle sind verfügbar; andere Anfragen erhalten 403 mit Ende und Anlass - Super-Keys (key create --super) dürfen trotz beider Einschränkungen alles - Beim Anlegen werden Speicher der Pins, Überschneidungen exklusiver Einträge und Modellzeitfenster sowie Pins außerhalb ihres Fensters geprüft - Wöchentliche Zeiten dürfen über Mitternacht reichen (z. B. 22:00-02:00) - Unit-Tests und tests/multispark/schedule_test.py Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2d607b5bdf
commit
aab87f38e5
11 files changed
+1000
-516
No files matched your search
@@ -13,7 +13,7 @@ BIN = "../../target/debug/omega-proxy"
|
||||
|
||||
|
||||
def pin(*args):
|
||||
r = subprocess.run([BIN, "-c", "proxy.toml", "pin", *args], capture_output=True, text=True)
|
||||
r = subprocess.run([BIN, "-c", "proxy.toml", "schedule", *args], capture_output=True, text=True)
|
||||
out = (r.stdout + r.stderr).strip().splitlines()
|
||||
return r.returncode, out[-1] if out else ""
|
||||
|
||||
@@ -44,26 +44,26 @@ monitor = Monitor()
|
||||
monitor.start()
|
||||
|
||||
print("1) Prüfung beim Anlegen")
|
||||
code, out = pin("add", "ollama/gibtsnicht")
|
||||
code, out = pin("pin", "ollama/gibtsnicht")
|
||||
print(f" {out}")
|
||||
check(code != 0 and "auf keinem Rechner" in out, "unbekanntes Modell abgelehnt")
|
||||
code, out = pin("add", "ollama/qwen3:0.6b")
|
||||
code, out = pin("pin", "ollama/qwen3:0.6b")
|
||||
print(f" {out}")
|
||||
check(code != 0 and "--node" in out, "Modell auf mehreren Sparks braucht --node")
|
||||
|
||||
print("2) Dauerhafter Pin und wöchentlicher Pin, der gerade läuft, werden ohne Anfrage geladen")
|
||||
code, out = pin("add", "vllm/smollm2-360m", "--note", "Dienst X")
|
||||
code, out = pin("pin", "vllm/smollm2-360m", "--note", "Dienst X")
|
||||
print(f" {out}")
|
||||
check(code == 0, "dauerhafter Pin angelegt (Rechner automatisch, nur spark1 bietet das Modell an)")
|
||||
now = datetime.datetime.now()
|
||||
day = ["mo", "di", "mi", "do", "fr", "sa", "so"][now.weekday()]
|
||||
start = max(now - datetime.timedelta(hours=1), now.replace(hour=0, minute=0)).strftime("%H:%M")
|
||||
end = min(now + datetime.timedelta(hours=1), now.replace(hour=23, minute=59)).strftime("%H:%M")
|
||||
code, out = pin("add", "llamacpp/qwen3-0.6b", "--weekly", day, "--time", f"{start}-{end}",
|
||||
code, out = pin("pin", "llamacpp/qwen3-0.6b", "--weekly", day, "--time", f"{start}-{end}",
|
||||
"--from", "2026-10-01", "--until", "2027-02-15", "--note", "Vorlesung KI")
|
||||
print(f" {out}")
|
||||
check(code == 0, f"wöchentlicher Pin {day} {start}-{end} im Semester angelegt")
|
||||
code, out = pin("add", "vllm/qwen2.5-0.5b", "--node", "spark1")
|
||||
code, out = pin("pin", "vllm/qwen2.5-0.5b", "--node", "spark1")
|
||||
print(f" {out}")
|
||||
check(code != 0 and "1600 MB gepinnt" in out, "dritter Pin auf spark1 abgelehnt: 400 + 600 + 600 > 1200 MB")
|
||||
t0 = time.time()
|
||||
@@ -71,7 +71,7 @@ loaded = wait_for(lambda: all(
|
||||
(s := slot("spark1", e, m)) and s["state"] == "loaded" and s["pinned"]
|
||||
for e, m in [("vllm", "smollm2-360m"), ("llamacpp", "qwen3-0.6b")]), 30)
|
||||
check(loaded, f"beide auf spark1 geladen und gepinnt, ohne Anfrage ({time.time() - t0:.0f} s)")
|
||||
print(" " + "\n ".join(l for l in subprocess.run([BIN, "-c", "proxy.toml", "pin", "list"],
|
||||
print(" " + "\n ".join(l for l in subprocess.run([BIN, "-c", "proxy.toml", "schedule", "list"],
|
||||
capture_output=True, text=True).stdout.splitlines()))
|
||||
show_status()
|
||||
|
||||
@@ -84,7 +84,7 @@ check(slot("spark1", "vllm", "smollm2-360m") and slot("spark1", "llamacpp", "qwe
|
||||
"beide gepinnten Modelle noch geladen")
|
||||
|
||||
print("4) Pin für einen Zeitraum: +30 s bis +55 s auf spark2, Vorlauf 15 s")
|
||||
code, out = pin("add", "vllm/qwen2.5-0.5b", "--node", "spark2", "--from", "+30s", "--until", "+55s")
|
||||
code, out = pin("pin", "vllm/qwen2.5-0.5b", "--node", "spark2", "--from", "+30s", "--until", "+55s")
|
||||
print(f" {out}")
|
||||
t0 = time.time()
|
||||
check(code == 0, "Pin angelegt")
|
||||
@@ -103,7 +103,7 @@ s = slot("spark2", "vllm", "qwen2.5-0.5b")
|
||||
check(s is not None and not s["pinned"], "bleibt geladen, ist aber wieder verdrängbar")
|
||||
|
||||
print("5) Pins entfernen: die Modelle werden wieder verdrängbar")
|
||||
for line in subprocess.run([BIN, "-c", "proxy.toml", "pin", "list"], capture_output=True, text=True).stdout.splitlines():
|
||||
for line in subprocess.run([BIN, "-c", "proxy.toml", "schedule", "list"], capture_output=True, text=True).stdout.splitlines():
|
||||
pid = line.split()[0]
|
||||
code, out = pin("remove", pid)
|
||||
print(f" {out}")
|
||||
|
||||
Reference in new issue
Block a user