Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/runtime-policy.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ function runtimeRows(config, status, requestedRuntimeId, requesterNode) {
return Object.entries(config.runtimes ?? {}).map(([runtimeId, runtime]) => {
const runtimeStatus = status?.runtimes?.[runtimeId] ?? {};
const requested = runtimeId === requestedRuntimeId;
const loaded = isRuntimeLoaded(runtimeStatus);
// A disabled external runtime is not LLooM's; its last status says nothing about memory.
const retired = runtime.enabled !== true && runtime.management === 'external';
const loaded = !retired && isRuntimeLoaded(runtimeStatus);
const ownedByDistributedGroup = distributedMembers.has(runtimeId);
const authority = runtimeAuthority(config, runtimeId);
const memoryGb = ownedByDistributedGroup ? 0 : runtimeMemoryGb(runtime);
Expand Down
26 changes: 26 additions & 0 deletions test/runtime-policy.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -634,4 +634,30 @@ const applied = await applyRuntimePolicyPlan(unpinnedPolicyConfig, fakePolicyMan
assert.equal(applied.dryRun, false);
assert.deepEqual(policyOperations, ['stop:warm', 'start:big:unit-admit']);

// A disabled external runtime is not LLooM's: its stale status neither counts nor gets stopped.
// A disabled managed runtime that is still up keeps counting until LLooM stops it.
const retiredPlan = await createRuntimePolicyPlan(
{
runtimePolicy: { memoryBudgetGb: 40 },
runtimes: {
retired: { enabled: false, management: 'external', memoryGb: 30 },
draining: { enabled: false, memoryGb: 5 },
requested: { enabled: true, memoryGb: 30 }
}
},
{
requestedRuntimeId: 'requested',
status: {
runtimes: {
retired: { healthy: true, status: 'external' },
draining: { healthy: true, status: 'running' },
requested: { healthy: false, status: 'idle' }
}
}
}
);
assert.equal(retiredPlan.admission.projectedMemoryGb, 35);
assert.equal(retiredPlan.admission.allowed, true);
assert(!retiredPlan.actions.some((action) => action.runtimeId === 'retired'));

console.log('runtime-policy tests passed');
Loading