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

handling review comments

parent 2ffa4c1c
No related branches found
No related tags found
3 merge requests!333get all the new changes from master into the branch,!330still a bug,!328Solving Feature SDCP-239
Pipeline #68500 passed
VERSION = "Version 1.0.0 (14 jan 2020)"
TASKS_PER_PAGE = 50 TASKS_PER_PAGE = 50
TASKS_PER_PAGE_SMALL = 10 TASKS_PER_PAGE_SMALL = 10
...@@ -329,6 +329,18 @@ class Task(models.Model): ...@@ -329,6 +329,18 @@ class Task(models.Model):
@property @property
def sasid_ingested_fraction(self): def sasid_ingested_fraction(self):
"""
This 'property' of a task returns the fraction of queued/ingested tasks per SAS_ID
and a list of statusses of other tasks belonging to the same SAS_ID.
It is implemented as 'property', because then it can be used in html pages like this:
<td>{{ task.sasid_ingested_fraction.status }}</td>
<td>{{ task.sasid_ingested_fraction.completion }}%</td>
A selection of statusses are considered 'queued', and another selection is considered 'ingested'.
The division of those 2 are returned as a 'completed %'.
A limited list of statusses for the other tasks that belong to this SAS_ID is also returned.
"""
result = {} result = {}
statusses = {'scrubbed': 0, 'archiving': 0, 'archived': 0, 'finished': 0, statusses = {'scrubbed': 0, 'archiving': 0, 'archived': 0, 'finished': 0,
'suspended': 0,'discarded': 0, 'archived_failed': 0, 'finished_failed': 0} 'suspended': 0,'discarded': 0, 'archived_failed': 0, 'finished_failed': 0}
...@@ -337,7 +349,7 @@ class Task(models.Model): ...@@ -337,7 +349,7 @@ class Task(models.Model):
for task in tasks: for task in tasks:
try: try:
statusses[task.status] = statusses[task.status] + 1 statusses[task.status] += 1
except: except:
pass pass
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<tr> <tr>
<td> <td>
{% include "taskdatabase/ingest/clear_filter_button.html" %} {% include "taskdatabase/ingest/clear_filter_button.html" %}
<a href="{% url 'task-set-filter' 'scrubbed' 'ingest' %}" class="btn btn-secondary btn-sm" role="button">Queued</a> <a href="{% url 'task-set-filter' 'scrubbed' 'ingest' %}" class="btn btn-secondary btn-sm" role="button">Queued (scrubbed)</a>
<a href="{% url 'task-set-filter' 'archiving' 'ingest' %}" class="btn btn-secondary btn-sm" role="button"><i>Archiving</i></a> <a href="{% url 'task-set-filter' 'archiving' 'ingest' %}" class="btn btn-secondary btn-sm" role="button"><i>Archiving</i></a>
</td> </td>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<div class="col-12"> <div class="col-12">
<h3>Ingest Queue</h3> <h3>Ingest Queue</h3>
SAS_ID's with tasks <i>archiving</i> or queued (<i>scrubbed</i>) for ingest into LTA. The ingest queue shows SASids with archiving and queued (scrubbed) tasks which are ingesting into the LTA
{% include 'taskdatabase/ingest/filter_buttons.html' %}&nbsp; {% include 'taskdatabase/ingest/filter_buttons.html' %}&nbsp;
......
...@@ -16,7 +16,8 @@ class TestIngestFraction(TestCase): ...@@ -16,7 +16,8 @@ class TestIngestFraction(TestCase):
Task.objects.get_or_create(filter='a',sas_id=54321, status='archived', workflow=workflow_requantisation) Task.objects.get_or_create(filter='a',sas_id=54321, status='archived', workflow=workflow_requantisation)
Task.objects.get_or_create(filter='a',sas_id=54321, status='finished', workflow=workflow_requantisation) Task.objects.get_or_create(filter='a',sas_id=54321, status='finished', workflow=workflow_requantisation)
Task.objects.get_or_create(filter='b',sas_id=54321, status='finished', workflow=workflow_requantisation) Task.objects.get_or_create(filter='b',sas_id=54321, status='finished', workflow=workflow_requantisation)
Task.objects.get_or_create(filter='b', sas_id=54321, status='discarded', workflow=workflow_requantisation) Task.objects.get_or_create(filter='a', sas_id=54321, status='discarded', workflow=workflow_requantisation)
Task.objects.get_or_create(filter='a', sas_id=54321, status='archived_failed', workflow=workflow_requantisation)
def test_ingest_fraction(self): def test_ingest_fraction(self):
# collapse all tasks into a single task for this sas_id # collapse all tasks into a single task for this sas_id
...@@ -26,5 +27,5 @@ class TestIngestFraction(TestCase): ...@@ -26,5 +27,5 @@ class TestIngestFraction(TestCase):
statusses = task.sasid_ingested_fraction['status'] statusses = task.sasid_ingested_fraction['status']
completion = task.sasid_ingested_fraction['completion'] completion = task.sasid_ingested_fraction['completion']
self.assertEqual(statusses, {'scrubbed': 2, 'archiving': 1, 'archived': 1, 'finished': 2, 'discarded': 1}) self.assertEqual(statusses, {'scrubbed': 2, 'archiving': 1, 'archived': 1, 'finished': 2, 'discarded': 1, 'archived_failed': 1})
self.assertEqual(completion,50) self.assertEqual(completion,43)
...@@ -19,7 +19,7 @@ urlpatterns = [ ...@@ -19,7 +19,7 @@ urlpatterns = [
path('validation', views.ShowValidationPage.as_view(), name='validation'), path('validation', views.ShowValidationPage.as_view(), name='validation'),
path('failures', views.ShowFailuresPage.as_view(), name='failures'), path('failures', views.ShowFailuresPage.as_view(), name='failures'),
path('discarded', views.ShowDiscardedPage.as_view(), name='discarded'), path('discarded', views.ShowDiscardedPage.as_view(), name='discarded'),
path('ingest', views.ShowIngestPage.as_view(), name='ingest'), path('ingest', views.ShowIngestQPage.as_view(), name='ingest'),
path('finished', views.ShowFinishedPage.as_view(), name='finished'), path('finished', views.ShowFinishedPage.as_view(), name='finished'),
path('task_details/<int:id>/<page>', views.TaskDetails, name='task-details'), path('task_details/<int:id>/<page>', views.TaskDetails, name='task-details'),
......
...@@ -442,7 +442,7 @@ class ShowDiscardedPage(ListView): ...@@ -442,7 +442,7 @@ class ShowDiscardedPage(ListView):
return tasks return tasks
class ShowIngestPage(ListView): class ShowIngestQPage(ListView):
""" """
This shows aggregated tasks per sas_id that are queued for ingest or archiving This shows aggregated tasks per sas_id that are queued for ingest or archiving
Note that the global filter is also applied Note that the global filter is also applied
...@@ -488,7 +488,7 @@ class ShowIngestPage(ListView): ...@@ -488,7 +488,7 @@ class ShowIngestPage(ListView):
class ShowFinishedPage(ListView): class ShowFinishedPage(ListView):
""" """
This shows the tasks that are archived This shows the tasks that are finished
Note that the global filter is also applied Note that the global filter is also applied
""" """
template_name = 'taskdatabase/archived/page.html' template_name = 'taskdatabase/archived/page.html'
...@@ -1391,7 +1391,7 @@ def ChangePrioritySasID(request, pk, priority_change, page=0): ...@@ -1391,7 +1391,7 @@ def ChangePrioritySasID(request, pk, priority_change, page=0):
task.priority = priority task.priority = priority
task.save() task.save()
return redirect('ingest') return redirect_with_params('ingest', '?page=' + page)
......
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