Skip to content

Commit

Permalink
feat: modify run last month unified cost parameter by scheduler
Browse files Browse the repository at this point in the history
Signed-off-by: ImMin5 <[email protected]>
  • Loading branch information
ImMin5 committed Sep 26, 2024
1 parent 9f0676a commit ae0a746
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 ae0a746

Please sign in to comment.