diff --git a/atdb/taskdatabase/models.py b/atdb/taskdatabase/models.py index adb0cc5df6f592d110e0d05324245c038e431db8..071fca44d15a2e19bf2bc392ca9a9b6d14007800 100644 --- a/atdb/taskdatabase/models.py +++ b/atdb/taskdatabase/models.py @@ -8,7 +8,7 @@ import json import logging from .services import calculated_qualities as qualities -from .services.common import State, AggregationStrategy +from .services.common import State, AggregationStrategy, ACTIVITY_RESET_STATUSSEN logger = logging.getLogger(__name__) @@ -224,8 +224,8 @@ class Task(models.Model): # so that it won't be picked up again. # TODO: only activate when the aggregator service actually picks this up - #self.new_status = State.AGGREGATE.value - pass + self.new_status = State.AGGREGATE.value + #pass except Exception as error: @@ -260,6 +260,9 @@ class Task(models.Model): if (self.status != State.PROCESSED.value) & (self.new_status == State.PROCESSED.value): self.handle_aggregation() + if self.status in ACTIVITY_RESET_STATUSSEN: + self.is_aggregated = False + # check in the outputs if this task should be considered to be summary task self.is_summary = check_if_summary(self) diff --git a/atdb/taskdatabase/serializers.py b/atdb/taskdatabase/serializers.py index d1a28668aa2c5ae65e50b888445e591375d67533..75fb231ab3a334bc9b7d3a98708e9b197158a0ba 100644 --- a/atdb/taskdatabase/serializers.py +++ b/atdb/taskdatabase/serializers.py @@ -45,7 +45,7 @@ class TaskWriteSerializer(serializers.ModelSerializer): model = Task fields = ('id','task_type','filter','predecessor','successors', 'joined_output_task', - 'project','sas_id','priority','purge_policy','cleanup_policy','resume', + 'project','sas_id','priority','purge_policy','cleanup_policy','resume','is_aggregated', 'new_workflow_id','new_workflow_uri','workflow', 'stage_request_id', 'status','new_status','quality','calculated_qualities', diff --git a/atdb/taskdatabase/services/activities_handler.py b/atdb/taskdatabase/services/activities_handler.py index 14a69f6da5b7340391b5eef697318e918c7b0239..4f702918577bf98641424558369343f7833dc5d8 100644 --- a/atdb/taskdatabase/services/activities_handler.py +++ b/atdb/taskdatabase/services/activities_handler.py @@ -178,7 +178,7 @@ def update_processed_and_aggregate(task): current_is_processed = activity.is_processed activity.is_processed = True non_discarded_found = False - for t in Task.objects.filter(sas_id=task.sas_id): + for t in Task.objects.filter(sas_id=task.sas_id,task_type='regular'): if t.status not in PROCESSED_STATUSSES: activity.is_processed = False break @@ -202,7 +202,9 @@ def update_processed_and_aggregate(task): if (task.workflow.aggregation_strategy == AggregationStrategy.COLLECT_H5.value): # check if the activity is ready to collect H5 data - if (not activity.is_aggregated and activity.status != State.COLLECTING_DATA.value): + if (not activity.is_aggregated and + activity.status != State.COLLECTING_DATA.value and + activity.status != State.AGGREGATE.value): # check if there is already a storage_location, if not, add it. if not activity.storage_location: diff --git a/atdb/taskdatabase/templates/taskdatabase/index.html b/atdb/taskdatabase/templates/taskdatabase/index.html index 20043ea404d49f6265c69071675e2cb45fff7d8a..f50f7b8fdbff69bd0575c0390df29caec4b307e6 100644 --- a/atdb/taskdatabase/templates/taskdatabase/index.html +++ b/atdb/taskdatabase/templates/taskdatabase/index.html @@ -31,7 +31,7 @@ {% include 'taskdatabase/pagination.html' %} </div> </div> - <p class="footer"> Version 29 Jul 2024 + <p class="footer"> Version 30 Jul 2024 </div> {% include 'taskdatabase/refresh.html' %}