Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
THWiseman committed Nov 3, 2023
1 parent 5a381db commit ca61172
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package cromwell.backend.google.pipelines.common

import cromwell.backend.google.pipelines.common.CustomMachineType._
import eu.timepit.refined.api.Refined
import eu.timepit.refined.numeric.Positive
import eu.timepit.refined.refineV
import mouse.all._
import org.slf4j.Logger
import wdl4s.parser.MemoryUnit
import wom.format.MemorySize
import math.{log, pow}

case class PredefinedMachineType(cpuCount: Int, gcpString: String)
object PredefinedMachineType {
// hardcoded values from: https://cloud.google.com/compute/docs/general-purpose-machines#c3-standard
val c3Standard_4 = PredefinedMachineType(4, "c3-standard-4")
val c3Standard_8 = PredefinedMachineType(8, "c3-standard-8")
val c3Standard_22 = PredefinedMachineType(22, "c3-standard-22")
Expand All @@ -22,7 +19,7 @@ object PredefinedMachineType {
def getClosestC3Machine(requestedMemory: MemorySize, requestedCpu: Refined[Int, Positive], jobLogger: Logger): String = {
val adjustedMemory: MemorySize = MemorySize(requestedCpu.value * 4.0, MemoryUnit.GB)
if (adjustedMemory != requestedMemory) {
jobLogger.info(s"Adjusting memory from ${requestedMemory.amount} to ${adjustedMemory.amount} in order to match GCP requirements for the requested CPU.")
jobLogger.info(s"Adjusting memory from ${requestedMemory.toString} to ${adjustedMemory.toString} in order to match GCP requirements for the requested CPU.")
}
val machine = requestedCpu.value match {
case cpu if cpu <= 4 => c3Standard_4
Expand Down

0 comments on commit ca61172

Please sign in to comment.