From 366115dea976ecfb5692101f18fb90c80f55e74a Mon Sep 17 00:00:00 2001 From: javiergaitan Date: Tue, 17 Sep 2024 22:21:31 +0000 Subject: [PATCH] fix: Create a new standardMachineType runtime attribute instead of reusing cpuPlatform --- .../models/GcpBatchRuntimeAttributes.scala | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/models/GcpBatchRuntimeAttributes.scala b/supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/models/GcpBatchRuntimeAttributes.scala index 4609af772d7..bb6b4826e9f 100644 --- a/supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/models/GcpBatchRuntimeAttributes.scala +++ b/supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/models/GcpBatchRuntimeAttributes.scala @@ -49,7 +49,8 @@ final case class GcpBatchRuntimeAttributes(cpu: Int Refined Positive, continueOnReturnCode: ContinueOnReturnCode, noAddress: Boolean, useDockerImageCache: Option[Boolean], - checkpointFilename: Option[String] + checkpointFilename: Option[String], + standardMachineType: Option[String] ) object GcpBatchRuntimeAttributes { @@ -85,6 +86,8 @@ object GcpBatchRuntimeAttributes { UseDockerImageCacheKey ).optional + val StandardMachineTypeKey = "StandardMachineType" + val CheckpointFileKey = "checkpointFile" private val checkpointFileValidationInstance = new StringRuntimeAttributesValidation(CheckpointFileKey).optional @@ -98,6 +101,8 @@ object GcpBatchRuntimeAttributes { ) private def cpuPlatformValidation(runtimeConfig: Option[Config]): OptionalRuntimeAttributesValidation[String] = cpuPlatformValidationInstance + private def standardMachineTypeValidation(runtimeConfig: Option[Config]): OptionalRuntimeAttributesValidation[String] = + new StringRuntimeAttributesValidation(StandardMachineTypeKey).optional private def gpuTypeValidation(runtimeConfig: Option[Config]): OptionalRuntimeAttributesValidation[GpuType] = GpuTypeValidation.optional @@ -171,7 +176,8 @@ object GcpBatchRuntimeAttributes { bootDiskSizeValidation(runtimeConfig), useDockerImageCacheValidation(runtimeConfig), checkpointFileValidationInstance, - dockerValidation + dockerValidation, + standardMachineTypeValidation(runtimeConfig) ) } @@ -228,6 +234,10 @@ object GcpBatchRuntimeAttributes { useDockerImageCacheValidation(runtimeAttrsConfig).key, validatedRuntimeAttributes ) + val standardMachineType: Option[String] = RuntimeAttributesValidation.extractOption( + standardMachineTypeValidation(runtimeAttrsConfig).key, + validatedRuntimeAttributes + ) new GcpBatchRuntimeAttributes( cpu = cpu, @@ -243,7 +253,8 @@ object GcpBatchRuntimeAttributes { continueOnReturnCode = continueOnReturnCode, noAddress = noAddress, useDockerImageCache = useDockerImageCache, - checkpointFilename = checkpointFileName + checkpointFilename = checkpointFileName, + standardMachineType = standardMachineType ) }