From 38c400f9d8c2ab4e69771249b1ff7df03056b90b Mon Sep 17 00:00:00 2001 From: CY Khoo Date: Wed, 30 Oct 2024 14:23:28 +0800 Subject: [PATCH 1/2] Remove UTC library as it's not supported in Python3.9 --- services/ec2/Ec2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/ec2/Ec2.py b/services/ec2/Ec2.py index 622bfbd..3b7e8d8 100644 --- a/services/ec2/Ec2.py +++ b/services/ec2/Ec2.py @@ -3,7 +3,7 @@ import boto3 import botocore import requests -from datetime import date, datetime, timedelta, UTC +from datetime import date, datetime, timedelta import re import json @@ -407,7 +407,7 @@ def get_next_gen(instance_family): return new_instance_family # Define the time period for the this month - end_date = datetime.now(UTC) + end_date = datetime.now() start_date = end_date - timedelta(days=30) time_period = { 'Start': start_date.strftime('%Y-%m-%d'), From 010ce69eaee482e7bcac2f11ff7344fb3f3f6276 Mon Sep 17 00:00:00 2001 From: CY Khoo Date: Wed, 30 Oct 2024 14:28:35 +0800 Subject: [PATCH 2/2] Remove datetime.UTC dependency from EBS --- services/ec2/drivers/Ec2EbsVolume.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/ec2/drivers/Ec2EbsVolume.py b/services/ec2/drivers/Ec2EbsVolume.py index a3e643c..83b0396 100644 --- a/services/ec2/drivers/Ec2EbsVolume.py +++ b/services/ec2/drivers/Ec2EbsVolume.py @@ -42,7 +42,7 @@ def _checkEBSIops(self): check_days = 7 # number of days checked period = 60 * 60 # 1hr interval - end_time = datetime.datetime.now(datetime.UTC) + end_time = datetime.datetime.now() start_time = end_time - datetime.timedelta(days=check_days) for metric in metrics: