Skip to content

Commit

Permalink
stop spark context to prevent memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
vemonet committed Sep 19, 2023
1 parent 38b8a56 commit a495b4c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/openpredict_model/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ def calculateCombinedSimilarity(pairs_train, pairs_test, classes_train, classes_
test_df = sparkBuildFeatures(spark_context, pairs_test, classes_test,
knownDrugDis_bc.value, drug_df_bc.value, disease_df_bc.value)
log.info("Finishing Spark jobs 🏁")
spark_context.stop()
else:
log.info("Spark cluster not found, using pandas 🐼")
train_df = createFeatureDF(
Expand Down Expand Up @@ -569,6 +570,7 @@ def createFeaturesSparkOrDF(pairs, classes, drug_df, disease_df):
feature_df = sparkBuildFeatures(
spark_context, pairs, classes, knownDrugDis_bc.value, drug_df_bc.value, disease_df_bc.value)
log.info("Finishing Spark jobs 🏁")
spark_context.stop()
else:
log.info("Spark cluster not found, using pandas 🐼")
feature_df = createFeatureDF(
Expand Down

0 comments on commit a495b4c

Please sign in to comment.