From f8d1bf1122ef3ea8c05feeae9cbc15622926ce1f Mon Sep 17 00:00:00 2001 From: Jorrit Schaap <schaap@astron.nl> Date: Tue, 1 Dec 2020 06:43:26 +0100 Subject: [PATCH] TMSS-320: replaced FK by OneToOneField because a single dataproduct has a single archive info. renamed related_names. added ADLER32 hashtype --- SAS/TMSS/src/tmss/tmssapp/migrations/0001_initial.py | 10 +++++----- SAS/TMSS/src/tmss/tmssapp/models/scheduling.py | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/SAS/TMSS/src/tmss/tmssapp/migrations/0001_initial.py b/SAS/TMSS/src/tmss/tmssapp/migrations/0001_initial.py index 976ba4967af..e60f7e026f1 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.9 on 2020-11-26 16:26 +# Generated by Django 3.0.9 on 2020-12-01 05:41 from django.conf import settings import django.contrib.postgres.fields @@ -1214,12 +1214,12 @@ class Migration(migrations.Migration): migrations.AddField( model_name='dataproducttransform', name='input', - field=models.ForeignKey(help_text='A dataproduct that was the input of a transformation.', on_delete=django.db.models.deletion.PROTECT, related_name='inputs', to='tmssapp.Dataproduct'), + field=models.ForeignKey(help_text='A dataproduct that was the input of a transformation.', on_delete=django.db.models.deletion.PROTECT, related_name='consumers', to='tmssapp.Dataproduct'), ), migrations.AddField( model_name='dataproducttransform', name='output', - field=models.ForeignKey(help_text='A dataproduct that was produced from the input dataproduct.', on_delete=django.db.models.deletion.PROTECT, related_name='outputs', to='tmssapp.Dataproduct'), + field=models.ForeignKey(help_text='A dataproduct that was produced from the input dataproduct.', on_delete=django.db.models.deletion.PROTECT, related_name='producers', to='tmssapp.Dataproduct'), ), migrations.AddConstraint( model_name='dataproductspecificationstemplate', @@ -1233,7 +1233,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='dataproducthash', name='dataproduct', - field=models.ForeignKey(help_text='The dataproduct to which this hash refers.', on_delete=django.db.models.deletion.PROTECT, to='tmssapp.Dataproduct'), + field=models.ForeignKey(help_text='The dataproduct to which this hash refers.', on_delete=django.db.models.deletion.PROTECT, related_name='hash', to='tmssapp.Dataproduct'), ), migrations.AddConstraint( model_name='dataproductfeedbacktemplate', @@ -1242,7 +1242,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='dataproductarchiveinfo', name='dataproduct', - field=models.ForeignKey(help_text='A dataproduct residing in the archive.', on_delete=django.db.models.deletion.PROTECT, to='tmssapp.Dataproduct'), + field=models.OneToOneField(help_text='A dataproduct residing in the archive.', on_delete=django.db.models.deletion.PROTECT, related_name='archive_info', to='tmssapp.Dataproduct'), ), migrations.AddField( model_name='dataproduct', diff --git a/SAS/TMSS/src/tmss/tmssapp/models/scheduling.py b/SAS/TMSS/src/tmss/tmssapp/models/scheduling.py index c59d3080844..4930b0a7887 100644 --- a/SAS/TMSS/src/tmss/tmssapp/models/scheduling.py +++ b/SAS/TMSS/src/tmss/tmssapp/models/scheduling.py @@ -82,6 +82,7 @@ class Algorithm(AbstractChoice): class Choices(Enum): MD5 = 'md5' AES256 = 'aes256' + ADLER32 = 'adler32' # @@ -354,8 +355,8 @@ class DataproductTransform(BasicCommon): Each output dataproduct of a Subtask is linked to the input dataproducts that are used to produce it. These transforms encode the provenance information needed when tracking dependencies between dataproducts. """ - input = ForeignKey('Dataproduct', related_name='inputs', on_delete=PROTECT, help_text='A dataproduct that was the input of a transformation.') - output = ForeignKey('Dataproduct', related_name='outputs', on_delete=PROTECT, help_text='A dataproduct that was produced from the input dataproduct.') + input = ForeignKey('Dataproduct', related_name='consumers', on_delete=PROTECT, help_text='A dataproduct that was the input of a transformation.') + output = ForeignKey('Dataproduct', related_name='producers', on_delete=PROTECT, help_text='A dataproduct that was produced from the input dataproduct.') identity = BooleanField(help_text='TRUE if this transform only copies, tars, or losslessly compresses its input, FALSE if the transform changes the data. Allows for efficient reasoning about data duplication.') @@ -377,14 +378,14 @@ class Cluster(NamedCommon): class DataproductArchiveInfo(BasicCommon): - dataproduct = ForeignKey('Dataproduct', on_delete=PROTECT, help_text='A dataproduct residing in the archive.') + dataproduct = OneToOneField('Dataproduct', related_name='archive_info', on_delete=PROTECT, help_text='A dataproduct residing in the archive.') storage_ticket = CharField(max_length=128, help_text='Archive-system identifier.') public_since = DateTimeField(null=True, help_text='Dataproduct is available for public download since this moment, or NULL if dataproduct is not (NULLable).') corrupted_since = DateTimeField(null=True, help_text='Earliest timestamp from which this dataproduct is known to be partially or fully corrupt, or NULL if dataproduct is not known to be corrupt (NULLable).') class DataproductHash(BasicCommon): - dataproduct = ForeignKey('Dataproduct', on_delete=PROTECT, help_text='The dataproduct to which this hash refers.') + dataproduct = ForeignKey('Dataproduct', related_name='hash', on_delete=PROTECT, help_text='The dataproduct to which this hash refers.') algorithm = ForeignKey('Algorithm', null=False, on_delete=PROTECT, help_text='Algorithm used (MD5, AES256).') hash = CharField(max_length=128, help_text='Hash value.') -- GitLab