Skip to content

Commit

Permalink
Merge pull request #275 from psarando/CORE-2011-fix-max-cpu-requests
Browse files Browse the repository at this point in the history
CORE-2011 Update max CPU reconciliation in DE job submissions.
  • Loading branch information
psarando authored Oct 15, 2024
2 parents 8e64313 + 2f65330 commit 3e62c8e
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/apps/service/apps/de/jobs/common.clj
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,18 @@
:min_cpu_cores
:min_disk_space]))

(defn- filter-max-requirement-keys
[m]
(select-keys m [:memory_limit
:max_cpu_cores]))
(defn- filter-container-max-requirements
[container]
(select-keys container [:memory_limit
:max_cpu_cores]))

(defn- filter-request-max-requirements
"Ensure max requirement requests from the client are at least 0,
so that any max set by a tool is not automatically requested,
then the job services can choose a reasonable default instead."
[requirements]
{:memory_limit (get requirements :memory_limit 0)
:max_cpu_cores (get requirements :max_cpu_cores 0)})

(defn- limit-container-min-requirement
[container req-key-min req-key-max]
Expand All @@ -79,8 +87,8 @@
(filter-min-requirement-keys container)
(filter-min-requirement-keys requirements))
(merge-with min
(filter-max-requirement-keys container)
(filter-max-requirement-keys requirements)))
(filter-container-max-requirements container)
(filter-request-max-requirements requirements)))
(limit-container-min-requirement :min_memory_limit :memory_limit)
(limit-container-min-requirement :min_cpu_cores :max_cpu_cores)))

Expand Down

0 comments on commit 3e62c8e

Please sign in to comment.