Skip to content

Commit

Permalink
Don't allow Node fields to be null
Browse files Browse the repository at this point in the history
  • Loading branch information
jjnesbitt committed Jan 15, 2024
1 parent 2c0eb53 commit 3781335
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,29 +68,27 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("name", models.CharField(default=None, max_length=64, null=True)),
("system_uuid", models.UUIDField(default=None, null=True)),
("cpu", models.PositiveIntegerField(default=None, null=True)),
("memory", models.PositiveIntegerField(default=None, null=True)),
("name", models.CharField(max_length=64)),
("system_uuid", models.UUIDField()),
("cpu", models.PositiveIntegerField()),
("memory", models.PositiveIntegerField()),
(
"capacity_type",
models.CharField(
choices=[("spot", "Spot"), ("on-demand", "On Demand")],
default=None,
max_length=12,
null=True,
),
),
(
"instance_type",
models.CharField(default=None, max_length=32, null=True),
models.CharField(max_length=32),
),
(
"instance_type_spot_price",
models.FloatField(
default=None,
help_text="The price per hour (in USD) of the spot instnce this job ran on, at the time of running. If ever the job runs on an on-demand node, this field will be null.",
null=True,
help_text="The price per hour (in USD) of the spot instnce this job ran on,"
" at the time of running. If ever the job runs on an on-demand node,"
" this field will be null.",
),
),
],
Expand Down
16 changes: 6 additions & 10 deletions analytics/analytics/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@ class NodeCapacityType(models.TextChoices):


class Node(models.Model):
name = models.CharField(max_length=64, null=True, default=None)
system_uuid = models.UUIDField(null=True, default=None)
cpu = models.PositiveIntegerField(null=True, default=None)
memory = models.PositiveIntegerField(null=True, default=None)
capacity_type = models.CharField(
max_length=12, choices=NodeCapacityType.choices, null=True, default=None
)
instance_type = models.CharField(max_length=32, null=True, default=None)
name = models.CharField(max_length=64)
system_uuid = models.UUIDField()
cpu = models.PositiveIntegerField()
memory = models.PositiveIntegerField()
capacity_type = models.CharField(max_length=12, choices=NodeCapacityType.choices)
instance_type = models.CharField(max_length=32)
instance_type_spot_price = models.FloatField(
null=True,
default=None,
help_text=(
"The price per hour (in USD) of the spot instnce this job ran on, at the time of"
" running. If ever the job runs on an on-demand node, this field will be null."
Expand Down

0 comments on commit 3781335

Please sign in to comment.