Skip to content
Snippets Groups Projects
Commit a3b026f0 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

Merge branch 'SDC-1423-use-aggregation-strategy' into 'master'

merge and deploy

See merge request !362
parents 22d5f98c ce9dc31f
Branches
No related tags found
1 merge request!362merge and deploy
Pipeline #90484 passed
...@@ -189,17 +189,6 @@ def update_processed_and_aggregate(task): ...@@ -189,17 +189,6 @@ def update_processed_and_aggregate(task):
if t.status != State.DISCARDED.value: if t.status != State.DISCARDED.value:
non_discarded_found = True non_discarded_found = True
# only save when changed
if activity.is_processed != current_is_processed:
# if the whole activity has become processed, then set the status of this activity to 'AGGREGATE'
# unless it was already aggregated
if (activity.is_processed & non_discarded_found):
if not (activity.is_aggregated):
activity.status = State.AGGREGATE.value
activity.save()
if (task.workflow.aggregation_strategy == AggregationStrategy.COLLECT_H5.value): if (task.workflow.aggregation_strategy == AggregationStrategy.COLLECT_H5.value):
# check if there is already a storage_location, if not, add it. # check if there is already a storage_location, if not, add it.
...@@ -227,6 +216,15 @@ def update_processed_and_aggregate(task): ...@@ -227,6 +216,15 @@ def update_processed_and_aggregate(task):
activity.save() activity.save()
# only save when changed
if activity.is_processed != current_is_processed:
# if the whole activity has become processed, then set the status of this activity to 'AGGREGATE'
# unless it was already aggregated
if (activity.is_processed & non_discarded_found):
if not (activity.is_aggregated):
activity.status = State.AGGREGATE.value
activity.save()
def update_is_verified(task): def update_is_verified(task):
""" """
......
...@@ -97,6 +97,11 @@ class TestUpdateActivity(TestCase): ...@@ -97,6 +97,11 @@ class TestUpdateActivity(TestCase):
outputs={"inspect": {"location": "file:///project/ldv/Share/run/2023/3/26/331_30608/inspect.h5", "basename": "inspect.h5", "nameroot": "inspect"}}) outputs={"inspect": {"location": "file:///project/ldv/Share/run/2023/3/26/331_30608/inspect.h5", "basename": "inspect.h5", "nameroot": "inspect"}})
self.task11.save() self.task11.save()
self.task12 = Task.objects.create(sas_id=114,
new_status='processed',
workflow=self.workflow_imaging_compression)
self.task12.save()
def test_created_activity(self): def test_created_activity(self):
""" """
test if activity is created test if activity is created
...@@ -217,3 +222,15 @@ class TestUpdateActivity(TestCase): ...@@ -217,3 +222,15 @@ class TestUpdateActivity(TestCase):
expected = "/project/ldv/Share/aggregate/113" expected = "/project/ldv/Share/aggregate/113"
actual = self.task11.activity.storage_location actual = self.task11.activity.storage_location
self.assertEqual(actual, expected) self.assertEqual(actual, expected)
def test_update_processed_and_aggregate(self):
# arrange
task = Task.objects.create(sas_id=114, new_status='processed', workflow=self.workflow_imaging_compression)
# act
task.save()
# assert
aggregation_tasks = Task.objects.filter(sas_id=114, task_type='aggregation')
self.assertEqual(len(aggregation_tasks),1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment