From 37813358632792757d1931cc52d0f561ac3960d7 Mon Sep 17 00:00:00 2001 From: Jacob Nesbitt Date: Mon, 15 Jan 2024 13:34:43 -0500 Subject: [PATCH] Don't allow Node fields to be null --- ...lter_job_aws_alter_job_duration_and_more.py | 18 ++++++++---------- analytics/analytics/models.py | 16 ++++++---------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/analytics/analytics/migrations/0006_jobpod_node_alter_job_aws_alter_job_duration_and_more.py b/analytics/analytics/migrations/0006_jobpod_node_alter_job_aws_alter_job_duration_and_more.py index c04f650bb..1154d4dff 100644 --- a/analytics/analytics/migrations/0006_jobpod_node_alter_job_aws_alter_job_duration_and_more.py +++ b/analytics/analytics/migrations/0006_jobpod_node_alter_job_aws_alter_job_duration_and_more.py @@ -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.", ), ), ], diff --git a/analytics/analytics/models.py b/analytics/analytics/models.py index 56efcbcc5..fca56d0e7 100644 --- a/analytics/analytics/models.py +++ b/analytics/analytics/models.py @@ -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."