From eee0538ec5d40f556646ee6039a3f4b70aa09a47 Mon Sep 17 00:00:00 2001 From: Taeyang-Kim Date: Wed, 26 Feb 2025 17:09:06 +0900 Subject: [PATCH] =?UTF-8?q?df.drop=20=EC=9D=B4=20None=20=EC=A7=80=EC=9B=90?= =?UTF-8?q?=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EC=9D=B4=EC=8A=88=20?= =?UTF-8?q?=EC=88=98=EC=A0=95,=20SPS=5FUpdate=5FTime=20=EA=B2=B0=EC=B8=A1?= =?UTF-8?q?=20=EC=8B=9C=20PriceEviction=5FUpdate=5FTime=EC=9D=84=20?= =?UTF-8?q?=EC=9D=B4=EC=9A=A9=ED=95=98=EB=8A=94=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../azure/lambda/current_collector/lambda_function_sps.py | 3 ++- .../azure/lambda/current_collector/utils/merge_df.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/collector/spot-dataset/azure/lambda/current_collector/lambda_function_sps.py b/collector/spot-dataset/azure/lambda/current_collector/lambda_function_sps.py index 7d781b9..0713e4a 100644 --- a/collector/spot-dataset/azure/lambda/current_collector/lambda_function_sps.py +++ b/collector/spot-dataset/azure/lambda/current_collector/lambda_function_sps.py @@ -89,12 +89,13 @@ def process_zone_data(price_saving_if_df, sps_res_df, time_datetime, is_true_zon if is_true_zone: prev_availability_zone_true_all_data_df = S3.read_file(f"{AZURE_CONST.S3_LATEST_ALL_DATA_AVAILABILITY_ZONE_TRUE_PKL_GZIP_SAVE_PATH}", 'pkl.gz') - prev_availability_zone_true_all_data_df.drop(columns=['id'], inplace=True) + workload_cols = ['InstanceTier', 'InstanceType', 'Region', 'AvailabilityZone', 'DesiredCount'] feature_cols = ['OndemandPrice', 'SpotPrice', 'IF', 'Score', 'SPS_Update_Time'] changed_df = None if prev_availability_zone_true_all_data_df is not None and not prev_availability_zone_true_all_data_df.empty: + prev_availability_zone_true_all_data_df.drop(columns=['id'], inplace=True) changed_df = compare_sps(prev_availability_zone_true_all_data_df, all_data_zone_true_df, workload_cols, feature_cols) update_success = update_latest(all_data_zone_true_df, is_true_zone) diff --git a/collector/spot-dataset/azure/lambda/current_collector/utils/merge_df.py b/collector/spot-dataset/azure/lambda/current_collector/utils/merge_df.py index 4bb3f98..4f8038a 100644 --- a/collector/spot-dataset/azure/lambda/current_collector/utils/merge_df.py +++ b/collector/spot-dataset/azure/lambda/current_collector/utils/merge_df.py @@ -19,6 +19,8 @@ def merge_if_saving_price_sps_df(price_saving_if_df, sps_df, availability_zones= join_df.rename(columns={'time_x': 'PriceEviction_Update_Time', 'time_y': 'SPS_Update_Time'}, inplace=True) join_df.drop(columns=['id', 'InstanceTypeSPS', 'RegionCodeSPS'], inplace=True) + join_df['SPS_Update_Time'].fillna(join_df['PriceEviction_Update_Time'], inplace=True) + columns = ["InstanceTier", "InstanceType", "Region", "OndemandPrice", "SpotPrice", "Savings", "IF", "DesiredCount", "Score", "SPS_Update_Time"]