Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
lucymcnatt committed Nov 26, 2024
1 parent 9a1771b commit faecfeb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -138,16 +141,16 @@ object BatchRequestExecutor {
// Get vm info for this job
val allocationPolicy = job.getAllocationPolicy

Check warning on line 142 in supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/api/request/BatchRequestExecutor.scala

View check run for this annotation

Codecov / codecov/patch

supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/api/request/BatchRequestExecutor.scala#L142

Added line #L142 was not covered by tests

//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

Check warning on line 147 in supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/api/request/BatchRequestExecutor.scala

View check run for this annotation

Codecov / codecov/patch

supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/api/request/BatchRequestExecutor.scala#L145-L147

Added lines #L145 - L147 were not covered by tests

//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))

Check warning on line 152 in supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/api/request/BatchRequestExecutor.scala

View check run for this annotation

Codecov / codecov/patch

supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/api/request/BatchRequestExecutor.scala#L150-L152

Added lines #L150 - L152 were not covered by tests


if (job.getStatus.getState == JobStatus.State.SUCCEEDED) {
RunStatus.Success(events, instantiatedVmInfo)

Check warning on line 155 in supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/api/request/BatchRequestExecutor.scala

View check run for this annotation

Codecov / codecov/patch

supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/api/request/BatchRequestExecutor.scala#L155

Added line #L155 was not covered by tests
} else if (job.getStatus.getState == JobStatus.State.RUNNING) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package cromwell.backend.google.batch.api class BatchRequestExecutorSpec {

}

0 comments on commit faecfeb

Please sign in to comment.