From c846b03d5d57d16bad01a2d51de4f5a053592aa0 Mon Sep 17 00:00:00 2001 From: Vermaas <vermaas@astron.nl> Date: Fri, 19 Apr 2024 07:35:32 +0200 Subject: [PATCH] deploy 1 (disabled aggregate functionality) --- atdb/atdb/static/taskdatabase/style.css | 14 ++++++---- atdb/taskdatabase/models.py | 4 ++- .../services/activities_handler.py | 12 +++++++-- .../static/taskdatabase/style.css | 9 +++---- .../templates/taskdatabase/index.html | 2 +- .../tests/test_models_processed_summary.py | 16 ++++++----- atdb/taskdatabase/tests/test_summary_tasks.py | 13 ++++----- .../tests/test_update_activity.py | 27 ++++++++++--------- 8 files changed, 57 insertions(+), 40 deletions(-) diff --git a/atdb/atdb/static/taskdatabase/style.css b/atdb/atdb/static/taskdatabase/style.css index 5a9474dc..5e4bce6b 100644 --- a/atdb/atdb/static/taskdatabase/style.css +++ b/atdb/atdb/static/taskdatabase/style.css @@ -3,12 +3,12 @@ TD { font-size: 12pt; } -.defining,.staging,.fetching,.processing,.storing,.scrub,.scrubbing,.archiving,.discarding,.pre_archiving { +.defining,.staging,.fetching,.processing,.storing,.scrub,.scrubbing,.archiving,.aggregating { font-style: italic; color: green; } -.defined,.staged,.fetched,.processed,.stored,.validated,.scrubbed,.archived,.pre_archived,.finished { +.defined,.staged,.fetched,.processed,.stored,.validated,.scrubbed,.archived,.finished,.aggregated { background-color: lemonchiffon; color: blue; } @@ -32,10 +32,9 @@ TD { background-color: lightgreen; } -.aggregate_failed { - font-weight: bold; +.aggregate_failed,.aggregating_failed { color: red; - background-color: lightgreen; + font-weight: bold; } @@ -149,3 +148,8 @@ p.title { display: inline-block; vertical-align: middle; } + +.img { + color: white; + font-family: "Courier New"; +} \ No newline at end of file diff --git a/atdb/taskdatabase/models.py b/atdb/taskdatabase/models.py index daf9ce30..46809a3f 100644 --- a/atdb/taskdatabase/models.py +++ b/atdb/taskdatabase/models.py @@ -239,7 +239,9 @@ class Task(models.Model): # if so, temporarily put it on hold so that the ancillary service can grab it with it if self.is_summary: - self.resume = False + #TODO: uncomment to enable aggregator + #self.resume = False + pass except Exception as error: # this should never happen diff --git a/atdb/taskdatabase/services/activities_handler.py b/atdb/taskdatabase/services/activities_handler.py index 0df9e790..68b1666b 100644 --- a/atdb/taskdatabase/services/activities_handler.py +++ b/atdb/taskdatabase/services/activities_handler.py @@ -136,16 +136,24 @@ def update_activity(task): if task.status in processed_statusses: 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): if t.status not in processed_statusses: activity.is_processed = False break + # at least one of the tasks should NOT be in discarded, + # otherwise a fully discarded SAS_ID will also register as 'is_processed' and ready to 'AGGREGATE' + if t.status != State.DISCARDED.value: + 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' - if activity.is_processed: - activity.status = State.AGGREGATE.value + if (activity.is_processed & non_discarded_found): + # TODO: uncomment to enable aggregator + # activity.status = State.AGGREGATE.value + pass activity.save() diff --git a/atdb/taskdatabase/static/taskdatabase/style.css b/atdb/taskdatabase/static/taskdatabase/style.css index 6ca2e945..5e4bce6b 100644 --- a/atdb/taskdatabase/static/taskdatabase/style.css +++ b/atdb/taskdatabase/static/taskdatabase/style.css @@ -3,12 +3,12 @@ TD { font-size: 12pt; } -.defining,.staging,.fetching,.processing,.storing,.scrub,.scrubbing,.archiving { +.defining,.staging,.fetching,.processing,.storing,.scrub,.scrubbing,.archiving,.aggregating { font-style: italic; color: green; } -.defined,.staged,.fetched,.processed,.stored,.validated,.scrubbed,.archived,.finished { +.defined,.staged,.fetched,.processed,.stored,.validated,.scrubbed,.archived,.finished,.aggregated { background-color: lemonchiffon; color: blue; } @@ -32,10 +32,9 @@ TD { background-color: lightgreen; } -.aggregate_failed { - font-weight: bold; +.aggregate_failed,.aggregating_failed { color: red; - background-color: lightgreen; + font-weight: bold; } diff --git a/atdb/taskdatabase/templates/taskdatabase/index.html b/atdb/taskdatabase/templates/taskdatabase/index.html index 9bbf7bce..35df7c2a 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 15 Apr 2024 + <p class="footer"> Version 19 Apr 2024 (a) </div> {% include 'taskdatabase/refresh.html' %} diff --git a/atdb/taskdatabase/tests/test_models_processed_summary.py b/atdb/taskdatabase/tests/test_models_processed_summary.py index 706e3acf..3b996d52 100644 --- a/atdb/taskdatabase/tests/test_models_processed_summary.py +++ b/atdb/taskdatabase/tests/test_models_processed_summary.py @@ -32,14 +32,16 @@ class TestProcessedSummary(TestCase): actual = self.task1.resume self.assertEqual(actual, True) - def test_processed_on_hold(self): - """ - task 2 is processed, and a summary dataproduct. Should go on hold - """ + # TODO: uncomment to enable aggregator + # def test_processed_on_hold(self): + # """ + # task 2 is processed, and a summary dataproduct. Should go on hold + # """ + # + # actual = self.task2.resume + # # this test fails, because "self.resume = False" is still commented out in models.py L249 + # self.assertEqual(actual, False) - actual = self.task2.resume - # this test fails, because "self.resume = False" is still commented out in models.py L249 - self.assertEqual(actual, False) def test_activity_is_processed(self): """ diff --git a/atdb/taskdatabase/tests/test_summary_tasks.py b/atdb/taskdatabase/tests/test_summary_tasks.py index 6aaafde8..667f837a 100644 --- a/atdb/taskdatabase/tests/test_summary_tasks.py +++ b/atdb/taskdatabase/tests/test_summary_tasks.py @@ -51,12 +51,13 @@ class TestSummaryTasks(TestCase): self.summary_task_processed_77777.save() self.assertTrue(self.summary_task_processed_77777.is_summary) - def test_summary_task_processed_goes_on_halt(self): - """ - test summary task, at 'stored' it should know that it is a summary task and return True) - """ - self.summary_task_processed_88888.save() - self.assertFalse(self.summary_task_processed_88888.resume) + # TODO: uncomment to enable aggregator + # def test_summary_task_processed_goes_on_hold(self): + # """ + # test summary task, at 'stored' it should know that it is a summary task and return True) + # """ + # self.summary_task_processed_88888.save() + # self.assertFalse(self.summary_task_processed_88888.resume) def test_activity_77777_not_is_processed(self): """ diff --git a/atdb/taskdatabase/tests/test_update_activity.py b/atdb/taskdatabase/tests/test_update_activity.py index 21253449..35501e48 100644 --- a/atdb/taskdatabase/tests/test_update_activity.py +++ b/atdb/taskdatabase/tests/test_update_activity.py @@ -185,16 +185,17 @@ class TestUpdateActivity(TestCase): actual = activity.is_processed self.assertEqual(actual, False) - def test_is_processed(self): - """ - task 6, 7 and 8 are processed, - activity.is_processed should be true and activity status should go to 'aggregate' - """ - - activity = self.task6.activity - - actual = activity.is_processed - self.assertEqual(actual, True) - - actual = activity.status - self.assertEqual(actual, State.AGGREGATE.value) \ No newline at end of file + # TODO: uncomment to enable aggregator + # def test_is_processed(self): + # """ + # task 6, 7 and 8 are processed, + # activity.is_processed should be true and activity status should go to 'aggregate' + # """ + # + # activity = self.task6.activity + # + # actual = activity.is_processed + # self.assertEqual(actual, True) + # + # actual = activity.status + # self.assertEqual(actual, State.AGGREGATE.value) \ No newline at end of file -- GitLab