Skip to content

Commit

Permalink
logging
Browse files Browse the repository at this point in the history
  • Loading branch information
lcouzens committed Jun 28, 2024
1 parent 7998787 commit 933e1c6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 8 additions & 0 deletions koku/masu/processor/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions koku/masu/test/processor/test_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 933e1c6

Please sign in to comment.