Skip to content

Commit

Permalink
Max mem workers (#29)
Browse files Browse the repository at this point in the history
Apply a maximum of 60GB to executor memory.
  • Loading branch information
johrstrom authored Apr 14, 2023
1 parent bc33a44 commit 46aac3a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion template/before.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
end
end

def exec_memory
calculated = avail_mem/context.num_workers.to_i
[60, calculated].min
end

spark_config = {
"spark.ui.reverseProxy" => "true",
#"spark.ui.reverseProxyUrl" => "https://ondemand.osc.edu/node/${SPARK_MASTER_HOST}/${SPARK_MASTER_WEBUI_PORT}",
Expand All @@ -46,7 +51,7 @@

def pyspark_submit_args
args = []
args.concat(["--executor-memory #{avail_mem/context.num_workers.to_i}G"]) unless extra_spark_config.has_key?('spark.executor.memory')
args.concat(["--executor-memory #{exec_memory}G"]) unless extra_spark_config.has_key?('spark.executor.memory')
args.concat(['--conf spark.driver.maxResultSize=0']) unless extra_spark_config.has_key?("spark.driver.maxResultSize")

if extra_spark_config.has_key?('spark.driver.memory')
Expand Down

0 comments on commit 46aac3a

Please sign in to comment.