Skip to content

ComputePoolService — DDL appendix

Generated from the architecture model

This page is rendered from model/**/*.yaml by tools/docs_model during mkdocs build. Edit the YAML, not this page; hand-written design lives on the linked service, platform and plane pages.

Dialect shown: SQL Server (nvarchar, uniqueidentifier, datetimeoffset). Migrations are authored as FluentMigrator classes in the service's DatabaseModel.Migrations project; the TenantId column and the NHibernate tenant filter follow canonical ADR-0100 in SharedDb mode.

dbo.ComputePools

Owner: ComputePool

CREATE TABLE [dbo].[ComputePools] (
    [PoolId] nvarchar(64) NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [Kind] int NOT NULL,
    [State] int NOT NULL,
    [Region] nvarchar(32) NOT NULL,
    [SecurityBoundary] int NOT NULL,
    [GpuType] nvarchar(64) NOT NULL,
    [GpuCount] int NOT NULL,
    [VramGb] int NOT NULL,
    [CpuCores] int NOT NULL,
    [RamGb] int NOT NULL,
    [PricePerHourUsd] decimal(10,4) NOT NULL,
    [Utilization] decimal(5,4) NOT NULL DEFAULT (0),
    [QueueDepth] int NOT NULL DEFAULT (0),
    [ColdStartSeconds] int NOT NULL,
    [EndpointRef] nvarchar(512) NOT NULL,
    [UtilizationReportedAt] datetimeoffset NULL,
    [Version] rowversion NOT NULL,
    CONSTRAINT [PK_ComputePools] PRIMARY KEY ([PoolId])
);
CREATE INDEX [IX_Pools_Tenant_State_Region] ON [dbo].[ComputePools] ([TenantId], [State], [Region]);
Column Type Null Key Description
PoolId nvarchar(64) no PK
TenantId nvarchar(64) no
Kind int no
State int no
Region nvarchar(32) no
SecurityBoundary int no
GpuType nvarchar(64) no
GpuCount int no
VramGb int no
CpuCores int no
RamGb int no
PricePerHourUsd decimal(10,4) no
Utilization decimal(5,4) no
QueueDepth int no
ColdStartSeconds int no
EndpointRef nvarchar(512) no
UtilizationReportedAt datetimeoffset yes
Version rowversion no

dbo.PoolModelCache

Owner: CachedModel

CREATE TABLE [dbo].[PoolModelCache] (
    [PoolId] nvarchar(64) NOT NULL,
    [Model] nvarchar(128) NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [LoadedAt] datetimeoffset NOT NULL,
    [LastUsedAt] datetimeoffset NOT NULL,
    [VramGb] int NOT NULL,
    CONSTRAINT [PK_PoolModelCache] PRIMARY KEY ([PoolId], [Model])
);
ALTER TABLE [dbo].[PoolModelCache] ADD CONSTRAINT [FK_PoolModelCache_ComputePools_PoolId] FOREIGN KEY ([PoolId]) REFERENCES [dbo].[ComputePools] ([PoolId]);
Column Type Null Key Description
PoolId nvarchar(64) no PK FK → ComputePools.PoolId
Model nvarchar(128) no PK
TenantId nvarchar(64) no
LoadedAt datetimeoffset no
LastUsedAt datetimeoffset no
VramGb int no

dbo.PlacementDecisions

Owner: PlacementDecision · Retention: 90 days

CREATE TABLE [dbo].[PlacementDecisions] (
    [PlacementId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [DeploymentId] nvarchar(128) NOT NULL,
    [RunId] uniqueidentifier NULL,
    [RequirementsJson] nvarchar(2000) NOT NULL,
    [CandidatesJson] nvarchar(max) NOT NULL,
    [ChosenPoolId] nvarchar(64) NULL,
    [Outcome] int NOT NULL,
    [DecidedAt] datetimeoffset NOT NULL,
    CONSTRAINT [PK_PlacementDecisions] PRIMARY KEY ([PlacementId])
);
CREATE INDEX [IX_Placements_Tenant_DecidedAt] ON [dbo].[PlacementDecisions] ([TenantId], [DecidedAt]);
Column Type Null Key Description
PlacementId uniqueidentifier no PK
TenantId nvarchar(64) no
DeploymentId nvarchar(128) no
RunId uniqueidentifier yes
RequirementsJson nvarchar(2000) no
CandidatesJson nvarchar(max) no
ChosenPoolId nvarchar(64) yes
Outcome int no
DecidedAt datetimeoffset no