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

add service filter for logentry

parent 1ce2cf8b
No related branches found
No related tags found
1 merge request!350SDC-1313 ancillary dataproducts to dcache (ATDB side)
Pipeline #78503 passed
......@@ -118,7 +118,7 @@ class Activity(models.Model):
# flag set by ATDB to indicate that all tasks of this Activity has been processed
is_processed = models.BooleanField(default=False)
# TODO: flag set (and used) by the ancillary service, so that it doesn't do double work
# flag set (and used) by the aggregator service, so that it doesn't do double work
is_aggregated = models.BooleanField(default=False)
finished_fraction = models.FloatField(blank=True, null=True)
......@@ -210,6 +210,7 @@ class Task(models.Model):
def save(self, *args, **kwargs):
# nv:1mar2023, temporary hack, set tasks 'on hold' as soon they get to 'scrubbed'
# (users forget to do that manually, causing unwanted ingests)
# nv:8apr2024, SDO asked for this hack to be removed again.
if (self.status != State.SCRUBBED.value) & (self.new_status == State.SCRUBBED.value):
self.resume = False
......@@ -231,31 +232,30 @@ class Task(models.Model):
self.calculated_qualities = qualities.calculate_qualities(self, tasks_for_this_sasid, quality_thresholds)
# when a task goes to PROCESSED...
if (self.status != State.PROCESSED.value) & (self.new_status == State.PROCESSED.value):
# ...but only when the tasks of this activity are not yet aggregated
# (because the aggregator service also sets tasks back to processed)
if (self.activity.status != State.AGGREGATED.value):
# check if this task is a summary task
self.is_summary = check_if_summary(self)
# if so, temporarily put it on hold so that the ancillary service can grab it with it
if self.is_summary:
# slightly bothered by the idea that ATDB puts it on HOLD and depends on the ancillary service
# to resume it. But users have earlier asked for the same dynamic for scrubbed. Acceptable
# TODO: (un)comment this
# We don't want ATDB holding tasks without a aggregator service in place to resume
self.resume = False
# TODO: Q: should ATDB do this? or the aggregator service?
#if (self.status != State.AGGREGATED.value) & (self.new_status == State.AGGREGATED.value):
# continue normal operations after aggregation,
# move the summary task back into the normal flow by setting it back to 'processed' and resume
#self.resume = True
#self.new_status = State.PROCESSED.value
if (self.status != State.PROCESSED.value) & (self.new_status == State.PROCESSED.value):
try:
# ...but only when the tasks of this activity are not yet aggregated
# (because the aggregator service also sets tasks back to processed)
if (self.activity.status != State.AGGREGATED.value):
# check if this task is a summary task
self.is_summary = check_if_summary(self)
# if so, temporarily put it on hold so that the ancillary service can grab it with it
if self.is_summary:
# slightly bothered by the idea that ATDB puts it on HOLD and depends on the ancillary service
# to resume it. But users have earlier asked for the same dynamic for scrubbed. Acceptable
# TODO: (un)comment this
# We don't want ATDB holding tasks without a aggregator service in place to resume
self.resume = False
except Exception as error:
# this should never happen
# But it can happen that tasks are inserted directly in an advanced status without going through
# the proper steps (like in tests). If that happens, just log the error and continue.
logger.error(error)
# nv:20feb2024, same as above, but for backward compatibilty reasons.
# For tasks that are already beyond PROCESSED, but not yet ingested.
......
......@@ -31,7 +31,7 @@
{% include 'taskdatabase/pagination.html' %}
</div>
</div>
<p class="footer"> Version 5 Apr 2024
<p class="footer"> Version 8 Apr 2024
</div>
{% include 'taskdatabase/refresh.html' %}
......
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