From 933e1c67ce342eb508a6d545b2e008bbd3c3f612 Mon Sep 17 00:00:00 2001 From: Luke Couzens Date: Fri, 28 Jun 2024 12:10:53 +0100 Subject: [PATCH] logging --- koku/masu/processor/orchestrator.py | 8 ++++++++ koku/masu/test/processor/test_orchestrator.py | 12 +++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/koku/masu/processor/orchestrator.py b/koku/masu/processor/orchestrator.py index 3ba149d848..b537fcc60a 100644 --- a/koku/masu/processor/orchestrator.py +++ b/koku/masu/processor/orchestrator.py @@ -142,6 +142,14 @@ def get_polling_batch(self): # Check processing delta wait and skip polling if provider not completed processing if check_currently_processing(schema_name, provider): # We still need to update the timestamp between runs + LOG.info( + log_json( + "get_polling_batch", + msg="processing currently in progress for provider", + schema=schema_name, + provider=provider.uuid, + ) + ) provider.polling_timestamp = self.dh.now_utc provider.save(update_fields=["polling_timestamp"]) continue diff --git a/koku/masu/test/processor/test_orchestrator.py b/koku/masu/test/processor/test_orchestrator.py index a573ecdf26..f2ddeb1fea 100644 --- a/koku/masu/test/processor/test_orchestrator.py +++ b/koku/masu/test/processor/test_orchestrator.py @@ -472,11 +472,7 @@ def test_get_reports(self, mock_check_setup_complete, mock_inspect): self.assertEqual(result, expected) @patch("masu.processor.orchestrator.WorkerCache") - @patch( - "masu.processor.orchestrator.check_currently_processing", - return_value=False, - ) - def test_orchestrator_args_polling_batch(self, mock_check_processing, *args): + def test_orchestrator_args_polling_batch(self, *args): """Test that args to Orchestrator change the polling-batch result""" # providing a UUID overrides the polling timestamp o = Orchestrator(provider_uuid=self.aws_provider_uuid) @@ -501,6 +497,12 @@ def test_orchestrator_args_polling_batch(self, mock_check_processing, *args): self.assertGreater(len(p), 0) self.assertEqual(len(p), expected_providers.count()) + # Check polling time updated while we are still processing + with patch("masu.processor.orchestrator.check_currently_processing", return_value=True): + o = Orchestrator(type=Provider.PROVIDER_AWS_LOCAL) + p = o.get_polling_batch() + self.assertEqual(len(p), 0) + def test_get_billing_months(self): """Test get_billing_months""" # test that num_months = 1 returns the current month