Skip to content

Commit

Permalink
Merge pull request #287 from ImMin5/master
Browse files Browse the repository at this point in the history
Modify run last month unified cost parameter by scheduler
  • Loading branch information
ImMin5 authored Sep 26, 2024
2 parents 9f0676a + ae0a746 commit 6982545
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/spaceone/cost_analysis/service/unified_cost_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def run_unified_cost_by_scheduler(self, params: dict) -> None:
config_mgr = ConfigManager()

current_hour = params["current_hour"]
current_month = datetime.utcnow().strftime("%Y-%m")
current_date = datetime.utcnow()
current_month = current_date.strftime("%Y-%m")

identity_mgr = IdentityManager()
domain_ids = identity_mgr.list_enabled_domain_ids()
Expand All @@ -70,7 +71,10 @@ def run_unified_cost_by_scheduler(self, params: dict) -> None:
if self._check_unified_cost_job_is_confirmed_with_month(
domain_id, current_month
):
self.run_last_month_unified_costs(domain_id, current_month)
last_month = (current_date - relativedelta(months=1)).strftime(
"%Y-%m"
)
self.run_last_month_unified_costs(domain_id, last_month)

except Exception as e:
_LOGGER.error(
Expand Down

0 comments on commit 6982545

Please sign in to comment.