Skip to content

Commit

Permalink
attempts to reduce memory usage
Browse files Browse the repository at this point in the history
  • Loading branch information
threnjen committed Dec 17, 2024
1 parent 4ee5b57 commit 13ef7ee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions aws_terraform_bgg/fargate_task_defs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module "rag_description_generation_ecs" {
execution_role_arn = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${var.rag_description_generation}_FargateExecutionRole"
image = "${data.aws_caller_identity.current.account_id}.dkr.ecr.${var.REGION}.amazonaws.com/${var.rag_description_generation}:latest"
cpu = "1024"
memory = "4096"
memory = "8192"
region = var.REGION
}

Expand All @@ -33,7 +33,7 @@ module "dev_rag_description_generation_ecs" {
execution_role_arn = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${var.rag_description_generation}_FargateExecutionRole"
image = "${data.aws_caller_identity.current.account_id}.dkr.ecr.${var.REGION}.amazonaws.com/dev_${var.rag_description_generation}:latest"
cpu = "1024"
memory = "4096"
memory = "8192"
region = var.REGION
}

Expand Down
6 changes: 5 additions & 1 deletion modules/rag_description_generation/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def load_reduced_game_df(self):

del game_df
gc.collect()
print("Loaded and refined games data")

return game_df_reduced

Expand All @@ -88,9 +89,10 @@ def merge_game_df_with_ratings_df(self, game_df_reduced):
path=RATINGS_CONFIGS["dirty_dfs_directory"],
file_name="ratings_data.pkl",
)
ratings_df["BGGId"] = ratings_df["BGGId"].astype("string")
ratings_df = ratings_df[["username", "BGGId", "rating"]]

print("Loaded user ratings data")

print(
f"Reducing user ratings to only include games in the reduced game dataframe\n"
)
Expand All @@ -100,6 +102,8 @@ def merge_game_df_with_ratings_df(self, game_df_reduced):
how="inner",
)

all_games_df["BGGId"] = all_games_df["BGGId"].astype(str)

del game_df_reduced
del ratings_df
gc.collect()
Expand Down

0 comments on commit 13ef7ee

Please sign in to comment.