From faecfeb6a94e5015deefd7d0af6029873b716916 Mon Sep 17 00:00:00 2001 From: lmcnatt <85642387+lucymcnatt@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:32:34 -0500 Subject: [PATCH] formatting --- .../batch/api/request/BatchRequestExecutor.scala | 15 +++++++++------ .../batch/api/BatchRequestExecutorSpec.scala | 3 +++ 2 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 supportedBackends/google/batch/src/test/scala/cromwell/backend/google/batch/api/BatchRequestExecutorSpec.scala diff --git a/supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/api/request/BatchRequestExecutor.scala b/supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/api/request/BatchRequestExecutor.scala index b46e08b633d..774d87f0f42 100644 --- a/supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/api/request/BatchRequestExecutor.scala +++ b/supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/api/request/BatchRequestExecutor.scala @@ -4,7 +4,10 @@ import com.google.api.gax.rpc.{ApiException, StatusCode} import com.google.cloud.batch.v1.AllocationPolicy.ProvisioningModel import com.google.cloud.batch.v1._ import com.typesafe.scalalogging.LazyLogging -import cromwell.backend.google.batch.actors.BatchApiAbortClient.{BatchAbortRequestSuccessful, BatchOperationIsAlreadyTerminal} +import cromwell.backend.google.batch.actors.BatchApiAbortClient.{ + BatchAbortRequestSuccessful, + BatchOperationIsAlreadyTerminal +} import cromwell.backend.google.batch.api.BatchApiRequestManager._ import cromwell.backend.google.batch.api.{BatchApiRequestManager, BatchApiResponse} import cromwell.backend.google.batch.models.{GcpBatchExitCode, RunStatus} @@ -138,16 +141,16 @@ object BatchRequestExecutor { // Get vm info for this job val allocationPolicy = job.getAllocationPolicy - //Get instances that can be created with this AllocationPolicy, only instances[0] is supported + // Get instances that can be created with this AllocationPolicy, only instances[0] is supported val instancePolicy = allocationPolicy.getInstances(0).getPolicy val machineType = instancePolicy.getMachineType - val preemtible = instancePolicy.getProvisioningModelValue == ProvisioningModel.PREEMPTIBLE + val preemtible = instancePolicy.getProvisioningModelValue == ProvisioningModel.PREEMPTIBLE.getNumber - //Each location can be a region or a zone. Only one region or multiple zones in one region is supported - val region = allocationPolicy.getLocation.getAllowedLocations(0) + // Each location can be a region or a zone. Only one region is supported, ex: "regions/us-central1" + val location = allocationPolicy.getLocation.getAllowedLocations(0) + val region = location.split("/").last val instantiatedVmInfo = Some(InstantiatedVmInfo(region, machineType, preemtible)) - if (job.getStatus.getState == JobStatus.State.SUCCEEDED) { RunStatus.Success(events, instantiatedVmInfo) } else if (job.getStatus.getState == JobStatus.State.RUNNING) { diff --git a/supportedBackends/google/batch/src/test/scala/cromwell/backend/google/batch/api/BatchRequestExecutorSpec.scala b/supportedBackends/google/batch/src/test/scala/cromwell/backend/google/batch/api/BatchRequestExecutorSpec.scala new file mode 100644 index 00000000000..b6ee713bf51 --- /dev/null +++ b/supportedBackends/google/batch/src/test/scala/cromwell/backend/google/batch/api/BatchRequestExecutorSpec.scala @@ -0,0 +1,3 @@ +package cromwell.backend.google.batch.api class BatchRequestExecutorSpec { + +}