Skip to content
Snippets Groups Projects
Commit 598aac3a authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-60: added related names to input/outputs/dataproducts of subtask models...

TMSS-60: added related names to input/outputs/dataproducts of subtask models and viewsets, so we can 'walk the graph'
parent 0096f0d5
No related branches found
No related tags found
1 merge request!154Resolve TMSS-60 and TMSS-171 and TMSS-198
......@@ -186,9 +186,9 @@ class SubtaskStateLog(BasicCommon):
class SubtaskInput(BasicCommon):
subtask = ForeignKey('Subtask', null=False, on_delete=CASCADE, help_text='Subtask to which this input specification refers.')
subtask = ForeignKey('Subtask', null=False, on_delete=CASCADE, related_name='inputs', help_text='Subtask to which this input specification refers.')
task_relation_blueprint = ForeignKey('TaskRelationBlueprint', null=True, on_delete=SET_NULL, help_text='Task Relation Blueprint which this Subtask Input implements (NULLable).')
producer = ForeignKey('SubtaskOutput', on_delete=PROTECT, help_text='The Subtask Output providing the input dataproducts.')
producer = ForeignKey('SubtaskOutput', on_delete=PROTECT, related_name='consumers', help_text='The SubtaskOutput producing the input dataproducts for this SubtaskInput.')
dataproducts = ManyToManyField('Dataproduct', help_text='The Dataproducts resulting from application of the filter at time of scheduling Although the dataproducts are simply the result of applying the filter on immutable data, the filter application could change over time. We thus store the result of this filtering directly to retain which input was specified for the task..')
selection_doc = JSONField(help_text='Filter to apply to the dataproducts of the producer, to derive input dataproducts when scheduling.')
selection_template = ForeignKey('SubtaskInputSelectionTemplate', on_delete=PROTECT, help_text='Schema used for selection_doc.')
......@@ -201,7 +201,7 @@ class SubtaskInput(BasicCommon):
class SubtaskOutput(BasicCommon):
subtask = ForeignKey('Subtask', null=False, on_delete=CASCADE, help_text='Subtask to which this output specification refers.')
subtask = ForeignKey('Subtask', null=False, on_delete=CASCADE, related_name='outputs', help_text='Subtask to which this output specification refers.')
class Dataproduct(BasicCommon):
......@@ -218,7 +218,7 @@ class Dataproduct(BasicCommon):
pinned_since = DateTimeField(null=True, help_text='When this dataproduct was pinned to disk, that is, forbidden to be removed, or NULL if not pinned (NULLable).')
specifications_doc = JSONField(help_text='Dataproduct properties (f.e. beam, subband), to distinguish them when produced by the same task, and to act as input for selections in the Task Input and Work Request Relation Blueprint objects.')
specifications_template = ForeignKey('DataproductSpecificationsTemplate', null=False, on_delete=CASCADE, help_text='Schema used for specifications_doc.')
producer = ForeignKey('SubtaskOutput', on_delete=PROTECT, help_text='Subtask Output which generates this dataproduct.')
producer = ForeignKey('SubtaskOutput', on_delete=PROTECT, related_name="dataproducts", help_text='Subtask Output which generates this dataproduct.')
do_cancel = DateTimeField(null=True, help_text='When this dataproduct was cancelled (NULLable). Cancelling a dataproduct triggers cleanup if necessary.')
expected_size = BigIntegerField(null=True, help_text='Expected size of dataproduct size, in bytes. Used for scheduling purposes. NULL if size is unknown (NULLable).')
size = BigIntegerField(null=True, help_text='Dataproduct size, in bytes. Used for accounting purposes. NULL if size is (yet) unknown (NULLable).')
......
......@@ -94,10 +94,11 @@ class SubtaskInputSerializer(serializers.HyperlinkedModelSerializer):
fields = '__all__'
class SubtaskOutputSerializer(serializers.HyperlinkedModelSerializer):
class SubtaskOutputSerializer(RelationalHyperlinkedModelSerializer):
class Meta:
model = models.SubtaskOutput
fields = '__all__'
extra_fields = ['dataproducts', 'consumers']
class DataproductSerializer(serializers.HyperlinkedModelSerializer):
......@@ -191,4 +192,5 @@ class SubtaskSerializerJSONeditorOnline(RelationalHyperlinkedModelSerializer):
class Meta:
model = models.Subtask
#fields = '__all__'
extra_fields = ['inputs', 'outputs']
exclude = ('created_or_updated_by_user',)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment