Name the sizes a node can ask for
Raw cpus and gpus are a property of the machines an installation has, so a node written against a cluster quietly stops meaning anything when the cluster is replaced. A node says "gpu-small" instead, and what that is stored here — editable, and read again every time the node is built, so changing the flavor changes what the next run gets. Memory joins the schema properly (`ram`, in MB, accepting "2G"), along with `duration_s` for how long a node is expected to take. That one is recorded and shown and nothing else yet: a statement for whoever is planning around the node, not a limit — the limit is still `timeout`. A flavor and a number for the same thing is refused, compared by value so an editor writing the whole object back with its defaults still round-trips. A name nothing stores is refused at the save, which covers the canvas and `fluksio sync` at once, and deleting one a node still asks for says which node. Four sizes are seeded on an installation that has none, and never re-seeded: re-adding one somebody deliberately removed is an argument nobody wins. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A6HeySA27EkGANZN95QySW
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
"""flavor
|
||||
|
||||
A named amount of machine — cores, cards and memory — so a node can ask for one
|
||||
by name. Seeded with a few sizes on first start, and editable afterwards: what
|
||||
"gpu-small" means is a property of the machines an installation has, and those
|
||||
change.
|
||||
|
||||
Revision ID: c7e2b9f34a15
|
||||
Revises: b3f1a7c50d92
|
||||
Create Date: 2026-08-27
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel.sql.sqltypes
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "c7e2b9f34a15"
|
||||
down_revision = "b3f1a7c50d92"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
"flavor",
|
||||
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(length=64), nullable=False),
|
||||
sa.Column("cpus", sa.Integer(), nullable=False),
|
||||
sa.Column("gpus", sa.Integer(), nullable=False),
|
||||
sa.Column("ram", sa.Integer(), nullable=False),
|
||||
sa.Column(
|
||||
"description",
|
||||
sqlmodel.sql.sqltypes.AutoString(length=255),
|
||||
nullable=False,
|
||||
),
|
||||
sa.PrimaryKeyConstraint("name"),
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_table("flavor")
|
||||
Reference in New Issue
Block a user