Rechner aus dem Pool nehmen: von Hand und als Wartung im Zeitplan
- Außerhalb des Pools: keine neuen Anfragen, nichts wird geladen; laufende
Anfragen enden, danach entlädt der Proxy die Modelle; Pins ruhen
- Von Hand: Tabelle pool_out, POST /omega/api/nodes/{name}/pool, CLI pool out/in/list,
Knöpfe auf Sparks & Modelle
- Geplant: Zeitplanart Wartung (Kind::Maintenance); Pins in einer Wartung sind ein Konflikt
- Modelle nur auf Rechnern außerhalb des Pools: 503 mit Grund, nicht in den Modelllisten
- Audit: node.out, node.in, maintenance.start, maintenance.end
- tests/multispark/pool_test.py
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
55116414e3
commit
18567382ef
13 files changed
+542
-28
No files matched your search
+69
-10
@@ -911,8 +911,9 @@ async function statusPage() {
|
||||
const waiting = status.nodes.reduce((a, n) => a + n.models.reduce((b, m) => b + m.waiting, 0), 0);
|
||||
const running = status.nodes.reduce((a, n) => a + n.models.reduce((b, m) => b + m.in_flight, 0), 0);
|
||||
const issues = status.nodes.reduce((a, n) => a + n.issues.length, 0);
|
||||
const outCount = status.nodes.filter((n) => n.out_of_pool).length;
|
||||
return h('div', { class: 'stack' },
|
||||
head('Administration', 'Sparks & Modelle', status.nodes.length + ' Rechner · ' + loaded + ' Modelle geladen · ' + waiting + ' Anfragen warten',
|
||||
head('Administration', 'Sparks & Modelle', status.nodes.length + ' Rechner' + (outCount ? ' (' + outCount + ' nicht im Pool)' : '') + ' · ' + loaded + ' Modelle geladen · ' + waiting + ' Anfragen warten',
|
||||
h('button', { class: 'btn', type: 'button', onclick: () => render() }, 'Aktualisieren')),
|
||||
h('div', { class: 'kpis' },
|
||||
h('div', { class: 'kpi' }, h('span', {}, 'Laufende Anfragen'), h('span', { class: 'value' }, num(running))),
|
||||
@@ -925,6 +926,36 @@ async function statusPage() {
|
||||
h('span', {}, h('span', { class: 'swatch vllm' }), 'vLLM'), h('span', {}, h('span', { class: 'swatch free' }), 'frei')));
|
||||
}
|
||||
|
||||
function takeOutOfPool(n) {
|
||||
openOverlay(n.name + ' aus dem Pool nehmen', (close) => {
|
||||
const error = h('div', { class: 'notice error', role: 'alert', hidden: true });
|
||||
const form = h('form', {
|
||||
class: 'stack small',
|
||||
onsubmit: async (e) => {
|
||||
e.preventDefault();
|
||||
try {
|
||||
await api('POST', '/nodes/' + encodeURIComponent(n.name) + '/pool', { in_pool: false, reason: formData(form).reason });
|
||||
close();
|
||||
state.flash = { kind: 'ok', text: n.name + ' ist aus dem Pool genommen.' };
|
||||
render();
|
||||
} catch (err) {
|
||||
error.textContent = err.message;
|
||||
error.hidden = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
h('p', {}, 'Neue Anfragen gehen an andere Rechner, hier wird nichts mehr geladen. Laufende Anfragen werden noch beendet, danach entlädt der Proxy die Modelle. Gepinnte Modelle ruhen, bis der Rechner wieder im Pool ist.'),
|
||||
h('div', { class: 'field-group' }, h('label', { for: 'pool-reason' }, 'Grund'),
|
||||
h('input', { id: 'pool-reason', name: 'reason', class: 'field', placeholder: 'z. B. Treiber-Update' })),
|
||||
h('span', { class: 'hint' }, 'Geplante Wartungen trägst du im Zeitplan ein.'),
|
||||
error,
|
||||
h('div', { class: 'actions' },
|
||||
h('button', { class: 'btn', type: 'button', onclick: close }, 'Abbrechen'),
|
||||
h('button', { class: 'btn primary', type: 'submit' }, 'Aus dem Pool nehmen')));
|
||||
return form;
|
||||
});
|
||||
}
|
||||
|
||||
function nodeCard(n) {
|
||||
const budget = n.budget_mb || 0;
|
||||
const models = n.models.slice().sort((a, b) => b.mb - a.mb);
|
||||
@@ -934,11 +965,25 @@ function nodeCard(n) {
|
||||
if (m.in_flight) return h('span', { class: 'status' }, h('span', { class: 'dot accent' }), m.in_flight + (m.in_flight === 1 ? ' laufende Anfrage' : ' laufende Anfragen'));
|
||||
return h('span', { class: 'muted' }, 'Leerlauf ' + Math.round(m.idle_secs / 60) + ' min');
|
||||
};
|
||||
return h('section', { class: 'card grow' },
|
||||
const out = n.out_of_pool;
|
||||
const draining = out && models.some((m) => m.in_flight);
|
||||
return h('section', { class: 'card grow' + (out ? ' out-of-pool' : '') },
|
||||
h('div', { class: 'card-head' },
|
||||
h('div', { class: 'actions' }, h('h2', { class: 'mono' }, n.name),
|
||||
n.budget_mb == null ? h('span', { class: 'chip bad' }, 'Speicher unbekannt') : h('span', { class: 'chip good' }, 'erreichbar')),
|
||||
n.budget_mb == null ? h('span', { class: 'chip bad' }, 'Speicher unbekannt') : h('span', { class: 'chip good' }, 'erreichbar'),
|
||||
out ? h('span', { class: 'chip bad' }, out.manual ? 'nicht im Pool' : 'Wartung') : h('span', { class: 'chip' }, 'im Pool')),
|
||||
h('span', { class: 'mono muted' }, mb(n.used_mb) + ' / ' + mb(n.budget_mb))),
|
||||
out ? h('div', { class: 'notice warn' },
|
||||
h('b', {}, out.manual ? 'Aus dem Pool genommen' : 'Wartung laut Zeitplan'),
|
||||
out.manual ? ' von ' + out.by + ' am ' + when(out.since) : out.until ? ' bis ' + when(out.until) : '',
|
||||
': ' + out.reason + '. ',
|
||||
draining ? 'Laufende Anfragen werden noch beendet, danach entlädt der Proxy die Modelle.' : 'Neue Anfragen gehen an andere Rechner; hier wird nichts geladen.')
|
||||
: null,
|
||||
n.suspended_pins.length ? h('div', { class: 'notice' }, 'Gepinnt, ruht solange: ', h('span', { class: 'mono' }, n.suspended_pins.join(', '))) : null,
|
||||
h('div', { class: 'actions' },
|
||||
!out ? h('button', { class: 'btn small', type: 'button', onclick: () => takeOutOfPool(n) }, 'Aus dem Pool nehmen') : null,
|
||||
out && out.manual ? h('button', { class: 'btn small primary', type: 'button', onclick: () => act(() => api('POST', '/nodes/' + encodeURIComponent(n.name) + '/pool', { in_pool: true }), n.name + ' ist wieder im Pool.') }, 'Wieder aufnehmen') : null,
|
||||
out && !out.manual ? h('a', { class: 'btn small', href: '#/schedule' }, 'Zum Zeitplan') : null),
|
||||
h('div', { class: 'membar', role: 'img', 'aria-label': 'Speicherbelegung ' + n.name + ': ' + models.map((m) => m.model + ' ' + mb(m.mb)).join(', ') },
|
||||
models.map((m) => h('div', { class: m.engine + (m.state === 'loaded' ? '' : ' loading'), style: { width: (budget ? m.mb / budget * 100 : 0) + '%' }, title: m.model + ' · ' + mb(m.mb) }, m.model))),
|
||||
n.issues.map((i) => h('div', { class: 'notice warn' }, i)),
|
||||
@@ -980,7 +1025,7 @@ function layoutLanes(segments) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const KIND_LABEL = { pin: 'Pin', exclusive: 'Exklusiv', window: 'Zeitfenster' };
|
||||
const KIND_LABEL = { pin: 'Pin', exclusive: 'Exklusiv', window: 'Zeitfenster', maintenance: 'Wartung' };
|
||||
|
||||
function startOfWeek(offset) {
|
||||
const now = new Date();
|
||||
@@ -1034,15 +1079,16 @@ function occurrences(e, dayStart) {
|
||||
}
|
||||
|
||||
async function schedulePage() {
|
||||
const [entries, models, groups] = await Promise.all([api('GET', '/schedule'), api('GET', '/models'), api('GET', '/groups')]);
|
||||
const [entries, models, groups, status] = await Promise.all([api('GET', '/schedule'), api('GET', '/models'), api('GET', '/groups'), api('GET', '/status')]);
|
||||
const nodes = status.nodes.map((n) => n.name);
|
||||
const weekStart = startOfWeek(state.week || 0);
|
||||
const weekEnd = new Date(weekStart.getTime() + 7 * 86400000);
|
||||
const label = 'KW ' + isoWeek(weekStart) + ' · ' + weekStart.toLocaleDateString('de-DE', { day: '2-digit', month: '2-digit' }) + '–'
|
||||
+ new Date(weekEnd.getTime() - 1).toLocaleDateString('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric' });
|
||||
const permanent = entries.filter((e) => !e.time.from && !e.time.until && !e.time.weekly);
|
||||
const shiftWeek = (d) => { state.week = d === 0 ? 0 : (state.week || 0) + d; render(); };
|
||||
const newEntry = (preset) => openOverlay('Neuer Eintrag', (close) => scheduleForm(models, groups, preset, close));
|
||||
const editEntry = (e) => openOverlay('Eintrag bearbeiten', (close) => scheduleForm(models, groups, null, close, e));
|
||||
const newEntry = (preset) => openOverlay('Neuer Eintrag', (close) => scheduleForm(models, groups, nodes, preset, close));
|
||||
const editEntry = (e) => openOverlay('Eintrag bearbeiten', (close) => scheduleForm(models, groups, nodes, null, close, e));
|
||||
const creator = (e) => e.creator || (e.created_by ? '#' + e.created_by : 'Kommandozeile');
|
||||
|
||||
// Kalender: eine Spalte je Tag, eine Zeile je Stunde. Ziehen markiert einen Zeitraum, ein Klick eine Stunde.
|
||||
@@ -1136,7 +1182,7 @@ async function schedulePage() {
|
||||
h('div', { class: 'toolbar' },
|
||||
h('span', { class: 'muted' }, 'Dauerhaft'),
|
||||
permanent.length ? permanent.map((e) => h('button', { type: 'button', class: 'chip ' + (e.kind.kind === 'pin' ? 'accent' : '') + ' mono', onclick: () => showEntry(e) }, KIND_LABEL[e.kind.kind] + ' · ' + e.subject)) : h('span', { class: 'muted' }, '–'),
|
||||
h('span', { class: 'legend' }, ['pin', 'exclusive', 'window'].map((k) => h('span', {}, h('span', { class: 'swatch ev-' + k }), KIND_LABEL[k])))),
|
||||
h('span', { class: 'legend' }, ['pin', 'exclusive', 'window', 'maintenance'].map((k) => h('span', {}, h('span', { class: 'swatch ev-' + k }), KIND_LABEL[k])))),
|
||||
h('section', { class: 'card cal-card' }, grid),
|
||||
h('section', { class: 'card' }, h('h2', {}, 'Alle Einträge'),
|
||||
entries.length ? h('div', { class: 'table-wrap' }, h('table', {},
|
||||
@@ -1180,7 +1226,7 @@ function entryTimes(e) {
|
||||
}
|
||||
|
||||
/** Formular für einen Zeitplaneintrag: neu (mit dem im Kalender markierten Zeitraum) oder ein eigener zum Bearbeiten */
|
||||
function scheduleForm(models, groups, preset, close, entry) {
|
||||
function scheduleForm(models, groups, nodes, preset, close, entry) {
|
||||
const error = h('div', { class: 'notice error', role: 'alert', hidden: true });
|
||||
const fail = (text) => { error.textContent = text; error.hidden = false; };
|
||||
const k = entry ? entry.kind : null;
|
||||
@@ -1255,6 +1301,13 @@ function scheduleForm(models, groups, preset, close, entry) {
|
||||
h('div', { class: 'field-group' }, h('label', { for: 's-users' }, 'Personen (Benutzernamen)'),
|
||||
h('input', { id: 's-users', name: 'users', class: 'field mono', placeholder: 'hofmannol, mueller', value: names.users.join(', ') })));
|
||||
}
|
||||
if (kind === 'maintenance') {
|
||||
subject.replaceChildren(h('span', { class: 'label' }, 'Rechner'),
|
||||
h('div', { class: 'model-picker' }, nodes.map((n) => h('label', { class: 'check' },
|
||||
h('input', { type: 'radio', name: 's-maint-node', value: n, checked: k && k.kind === 'maintenance' && k.node === n }),
|
||||
h('span', { class: 'mono' }, n)))),
|
||||
h('span', { class: 'hint' }, 'In dieser Zeit ist der Rechner nicht im Pool: keine neuen Anfragen, laufende enden, dann werden seine Modelle entladen. Pins auf diesem Rechner sind dann nicht möglich.'));
|
||||
}
|
||||
if (kind === 'window') {
|
||||
const picker = modelPicker(models, 's-model', true);
|
||||
if (k && k.kind === 'window') for (const i of picker.querySelectorAll('input')) i.checked = k.models.includes(i.value);
|
||||
@@ -1286,6 +1339,10 @@ function scheduleForm(models, groups, preset, close, entry) {
|
||||
body.models = checkedValues(form, 's-model');
|
||||
if (!body.models.length) return fail('Mindestens ein Modell auswählen.');
|
||||
}
|
||||
if (kind === 'maintenance') {
|
||||
body.node = checkedValues(form, 's-maint-node')[0];
|
||||
if (!body.node) return fail('Einen Rechner auswählen.');
|
||||
}
|
||||
if (!d.from || !d.until) return fail('Beginn und Ende angeben.');
|
||||
const span = new Date(d.until) - new Date(d.from);
|
||||
if (span <= 0) return fail('Das Ende muss nach dem Beginn liegen.');
|
||||
@@ -1312,7 +1369,7 @@ function scheduleForm(models, groups, preset, close, entry) {
|
||||
},
|
||||
},
|
||||
h('div', { class: 'field-group' }, h('span', { class: 'label' }, 'Art des Eintrags'),
|
||||
segmented('s-kind', [['pin', 'Pinnen'], ['exclusive', 'Exklusiv'], ['window', 'Zeitfenster']], kind, (v) => { kind = v; showSubject(); })),
|
||||
segmented('s-kind', [['pin', 'Pinnen'], ['exclusive', 'Exklusiv'], ['window', 'Zeitfenster'], ['maintenance', 'Wartung']], kind, (v) => { kind = v; showSubject(); })),
|
||||
subject,
|
||||
h('div', { class: 'fields' },
|
||||
h('div', { class: 'field-group' }, h('label', { for: 's-from' }, 'Beginn'), fromInput),
|
||||
@@ -1475,6 +1532,8 @@ const ACTIONS = {
|
||||
'recording.start': 'Aufzeichnung gestartet', 'recording.end': 'Aufzeichnung beendet', 'recording.ready': 'Aufzeichnung bereitgestellt',
|
||||
'recording.download': 'Aufzeichnung heruntergeladen', 'recording.delete': 'Aufzeichnung gelöscht',
|
||||
'usage.prune': 'Alte Metadaten gelöscht',
|
||||
'node.out': 'Rechner aus dem Pool genommen', 'node.in': 'Rechner wieder im Pool',
|
||||
'maintenance.start': 'Wartung begonnen', 'maintenance.end': 'Wartung beendet',
|
||||
};
|
||||
const actor = (a) => ({ system: 'System', scheduler: 'Proxy', cli: 'Kommandozeile' }[a] || a);
|
||||
|
||||
|
||||
Reference in new issue
Block a user