Skip to content

Commit

Permalink
Fixed some minor bus (#687)
Browse files Browse the repository at this point in the history
  • Loading branch information
athiruma authored Oct 19, 2023
1 parent 663cea5 commit 63982cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def _monitor_ticket_budget(self, ticket_id: str, region_name: str, budget: int,
remaining_budget = budget - used_budget
threshold_budget = budget - (budget * (self.__ticket_over_usage_limit / 100))
subject = body = None
if threshold_budget >= remaining_budget:
if threshold_budget >= remaining_budget > 0:
ticket_extended = self.extend_tickets_budget(ticket_id=ticket_id, region_name=region_name,
current_budget=budget)
if not ticket_extended:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class RunCRO:
def __init__(self):
self.__environment_variables_dict = environment_variables.environment_variables_dict
self.__es_operations = ElasticSearchOperations()
self.__account = self.__environment_variables_dict.get('account', '')
self.__account = self.__environment_variables_dict.get('account', '').lower()
self.__cloud_name = self.__environment_variables_dict.get('PUBLIC_CLOUD_NAME')
self.__cro_object = CroObject(public_cloud_name=self.__cloud_name)
self.__cost_over_usage = self.__cro_object.cost_over_usage()
Expand All @@ -34,10 +34,10 @@ def save_current_timestamp(self):
if not self.__es_operations.verify_elastic_index_doc_id(index=self.PERSISTENT_RUN_INDEX,
doc_id=self.PERSISTENT_RUN_DOC_ID):
self.__es_operations.upload_to_elasticsearch(index=self.PERSISTENT_RUN_INDEX, data={
f'last_run_{self.__account}': datetime.utcnow()}, id=self.PERSISTENT_RUN_DOC_ID)
f'last_run_{self.__account.lower()}': datetime.utcnow()}, id=self.PERSISTENT_RUN_DOC_ID)
else:
self.__es_operations.update_elasticsearch_index(index=self.PERSISTENT_RUN_INDEX,
metadata={f'last_run_{self.__account}': datetime.utcnow()},
metadata={f'last_run_{self.__account.lower()}': datetime.utcnow()},
id=self.PERSISTENT_RUN_DOC_ID)

@logger_time_stamp
Expand Down

0 comments on commit 63982cf

Please sign in to comment.