From 8f9d431015ff171b173daee8f847e31fefd68d80 Mon Sep 17 00:00:00 2001 From: jkuensem <jkuensem@physik.uni-bielefeld.de> Date: Wed, 9 Sep 2020 11:26:53 +0200 Subject: [PATCH] TMSS-319: Add missing archive_site field to cluster table --- SAS/TMSS/src/tmss/tmssapp/migrations/0001_initial.py | 3 ++- SAS/TMSS/src/tmss/tmssapp/models/scheduling.py | 1 + SAS/TMSS/src/tmss/tmssapp/populate.py | 2 +- SAS/TMSS/test/tmss_test_data_django_models.py | 3 ++- SAS/TMSS/test/tmss_test_data_rest.py | 1 + 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/SAS/TMSS/src/tmss/tmssapp/migrations/0001_initial.py b/SAS/TMSS/src/tmss/tmssapp/migrations/0001_initial.py index 1b122a91b85..f327b9bb689 100644 --- a/SAS/TMSS/src/tmss/tmssapp/migrations/0001_initial.py +++ b/SAS/TMSS/src/tmss/tmssapp/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.0.8 on 2020-09-02 16:52 +# Generated by Django 3.0.8 on 2020-09-09 09:23 from django.conf import settings import django.contrib.postgres.fields @@ -52,6 +52,7 @@ class Migration(migrations.Migration): ('name', models.CharField(help_text='Human-readable name of this object.', max_length=128)), ('description', models.CharField(help_text='A longer description of this object.', max_length=255)), ('location', models.CharField(help_text='Human-readable location of the cluster.', max_length=128)), + ('archive_site', models.BooleanField(help_text='TRUE if this cluster is an archive site, FALSE if not (f.e. a local cluster, or user-owned cluster).')), ], options={ 'abstract': False, diff --git a/SAS/TMSS/src/tmss/tmssapp/models/scheduling.py b/SAS/TMSS/src/tmss/tmssapp/models/scheduling.py index 9981cc0c583..d658ff43c17 100644 --- a/SAS/TMSS/src/tmss/tmssapp/models/scheduling.py +++ b/SAS/TMSS/src/tmss/tmssapp/models/scheduling.py @@ -320,6 +320,7 @@ class Filesystem(NamedCommon): class Cluster(NamedCommon): location = CharField(max_length=128, help_text='Human-readable location of the cluster.') + archive_site = BooleanField(help_text='TRUE if this cluster is an archive site, FALSE if not (f.e. a local cluster, or user-owned cluster).') class DataproductArchiveInfo(BasicCommon): diff --git a/SAS/TMSS/src/tmss/tmssapp/populate.py b/SAS/TMSS/src/tmss/tmssapp/populate.py index 67d8048759c..9331a7264e4 100644 --- a/SAS/TMSS/src/tmss/tmssapp/populate.py +++ b/SAS/TMSS/src/tmss/tmssapp/populate.py @@ -179,7 +179,7 @@ def populate_resources(apps, schema_editor): def populate_misc(apps, schema_editor): - cluster = Cluster.objects.create(name="CEP4", location="CIT") + cluster = Cluster.objects.create(name="CEP4", location="CIT", archive_site=False) fs = Filesystem.objects.create(name="LustreFS", cluster=cluster, capacity=3.6e15) diff --git a/SAS/TMSS/test/tmss_test_data_django_models.py b/SAS/TMSS/test/tmss_test_data_django_models.py index f3c6d8664c4..dd47feef976 100644 --- a/SAS/TMSS/test/tmss_test_data_django_models.py +++ b/SAS/TMSS/test/tmss_test_data_django_models.py @@ -369,7 +369,7 @@ def Subtask_test_data(task_blueprint: models.TaskBlueprint=None, subtask_templat stop_time = datetime.utcnow() + timedelta(minutes=10) if cluster is None: - cluster = models.Cluster.objects.create(name="dummy cluster", location="downstairs", tags=[]) + cluster = models.Cluster.objects.create(name="dummy cluster", location="downstairs", archive_site=True, tags=[]) if state is None: state = models.SubtaskState.objects.get(value='defining') @@ -445,6 +445,7 @@ def Filesystem_test_data(directory="/") -> dict: def Cluster_test_data(name="default cluster") -> dict: return {"name": name, "location": "upstairs", + "archive_site": True, "tags": ['tmss', 'testing']} def DataproductArchiveInfo_test_data() -> dict: diff --git a/SAS/TMSS/test/tmss_test_data_rest.py b/SAS/TMSS/test/tmss_test_data_rest.py index 12efcc9bb89..fb60b94907a 100644 --- a/SAS/TMSS/test/tmss_test_data_rest.py +++ b/SAS/TMSS/test/tmss_test_data_rest.py @@ -445,6 +445,7 @@ class TMSSRESTTestDataCreator(): return {"name": name if name else "Cluster %s" % uuid.uuid4(), "description": 'My one cluster', "location": "upstairs", + "archive_site": False, "tags": ['tmss', 'testing']} def Subtask(self, cluster_url=None, task_blueprint_url=None, specifications_template_url=None, specifications_doc=None, state:str="defining"): -- GitLab