Skip to content

Commit

Permalink
Merge pull request #311 from whdalsrnt/master
Browse files Browse the repository at this point in the history
refactor: refactor cost sync job
  • Loading branch information
whdalsrnt authored Jan 14, 2025
2 parents 19b8cd3 + 3aff23c commit f3727c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/spaceone/cost_analysis/manager/data_source_rule_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ def _change_cost_data_with_actions(
workspace_id: str = None,
):
for action, value in actions.items():

if action == "match_workspace" and value:
source = value["source"]
target_key = value.get("target", "workspace_id")
Expand Down Expand Up @@ -261,9 +260,9 @@ def _get_project(
if total_count > 0:
project_info = results[0]

self._project_info[f"project:{domain_id}:{target_key}:{target_value}"] = (
project_info
)
self._project_info[
f"project:{domain_id}:{target_key}:{target_value}"
] = project_info
return project_info

def _get_workspace(
Expand All @@ -288,9 +287,9 @@ def _get_workspace(
if total_count > 0:
workspace_info = results[0]

self._workspace_info[f"workspace:{domain_id}:{target_key}:{target_value}"] = (
workspace_info
)
self._workspace_info[
f"workspace:{domain_id}:{target_key}:{target_value}"
] = workspace_info
return workspace_info

def _change_cost_data_by_rule(
Expand Down
2 changes: 1 addition & 1 deletion src/spaceone/cost_analysis/service/job_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ def _distinct_job_id(
query["filter"].append({"k": "billed_month", "v": end, "o": "lte"})

_LOGGER.debug(f"[_distinct_job_id] query: {query}")
response = self.cost_mgr.stat_monthly_costs(query, domain_id)
response = self.cost_mgr.stat_costs(query, domain_id)
values = response.get("results", [])

_LOGGER.debug(f"[_distinct_job_id] job_ids: {values}")
Expand Down

0 comments on commit f3727c4

Please sign in to comment.