Skip to content

Commit

Permalink
Merge pull request #517 from ddps-lab/azure-collector-fix
Browse files Browse the repository at this point in the history
Azure colloector 의 Lambda 로그중 불필요 SettingWithCopyWarning 문제 해결.
  • Loading branch information
krtaiyang authored Feb 11, 2025
2 parents 7d96e2b + 89a705c commit 194abfc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@
# compare previous collected workload with current collected workload
# return changed workload
def compare(previous_df, current_df, workload_cols, feature_cols):
previous_df = previous_df.copy()
current_df = current_df.copy()

previous_df['OndemandPrice'] = previous_df['OndemandPrice'].fillna(-1)
current_df['OndemandPrice'] = current_df['OndemandPrice'].fillna(-1)
previous_df['Savings'] = previous_df['Savings'].fillna(-1)
current_df['Savings'] = current_df['Savings'].fillna(-1)
previous_df['IF'] = previous_df['IF'].fillna(-1)
current_df['IF'] = current_df['IF'].fillna(-1)

previous_df = previous_df.dropna(axis=0, inplace=False)
current_df = current_df.dropna(axis=0, inplace=False)
previous_df = previous_df.dropna(axis=0)
current_df = current_df.dropna(axis=0)

previous_df.loc[:, 'Workload'] = previous_df[workload_cols].apply(lambda row: ':'.join(row.values.astype(str)), axis=1)
previous_df.loc[:, 'Feature'] = previous_df[feature_cols].apply(lambda row: ':'.join(row.values.astype(str)), axis=1)
Expand Down Expand Up @@ -78,4 +81,4 @@ def compare(previous_df, current_df, workload_cols, feature_cols):

current_df = current_df.loc[changed_indices].drop(['Workload', 'Feature'], axis=1)

return current_df
return current_df
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def submit_batch(records, counter, recursive):
# Check Database And Table Are Exist and Upload Data to Timestream
def upload_timestream(data, time_datetime):
data = data[['InstanceTier', 'InstanceType', 'Region', 'OndemandPrice', 'SpotPrice', 'IF']]
data = data.copy()

data['OndemandPrice'] = data['OndemandPrice'].fillna(-1)
data['SpotPrice'] = data['SpotPrice'].fillna(-1)
data['IF'] = data['IF'].fillna(-1)
Expand Down Expand Up @@ -80,6 +82,8 @@ def upload_timestream(data, time_datetime):
def update_latest(data, time_datetime):
data['id'] = data.index + 1
data = data[['id', 'InstanceTier', 'InstanceType', 'Region', 'OndemandPrice', 'SpotPrice', 'Savings', 'IF']]
data = data.copy()

data['OndemandPrice'] = data['OndemandPrice'].fillna(-1)
data['Savings'] = data['Savings'].fillna(-1)
data['IF'] = data['IF'].fillna(-1)
Expand Down

0 comments on commit 194abfc

Please sign in to comment.