Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed some minor bus #687

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading