Skip to content

Commit

Permalink
WX-1340 GCP Batch: Mount with extra colon issue and multiple zones su…
Browse files Browse the repository at this point in the history
…pport (#7240)

Co-authored-by: Adam Nichols <anichols@broadinstitute.org>
  • Loading branch information
dspeck1 and aednichols authored Nov 1, 2023
1 parent 4d16f01 commit 5bc7ac3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.google.cloud.batch.v1.Runnable.Container
import com.google.cloud.batch.v1.{Environment,Runnable, Volume}
import cromwell.backend.google.batch.models.GcpBatchConfigurationAttributes.GcsTransferConfiguration
import cromwell.backend.google.batch.models.{BatchParameter, GcpBatchInput, GcpBatchOutput}
//import cromwell.backend.google.batch.runnable.RunnableLabels._
import cromwell.core.path.Path
import mouse.all.anySyntaxMouse

Expand Down Expand Up @@ -60,8 +59,14 @@ object RunnableBuilder {
def withVolumes(volumes: List[Volume]): Runnable.Builder = {
val formattedVolumes = volumes.map { volume =>
val mountPath = volume.getMountPath
val mountOptions = Option(volume.getMountOptionsList).map(_.asScala.toList).getOrElse(List.empty)
s"$mountPath:$mountPath:${mountOptions.mkString(",")}"

val mountOptions = Option(volume.getMountOptionsList)
.map(_.asScala)
.filter(_.nonEmpty)
.map(_.mkString(":", ",", ""))
.getOrElse("")

s"$mountPath:$mountPath$mountOptions"
}

builder.setContainer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import wom.format.MemorySize

trait BatchUtilityConversions {


// construct zones string
def toZonesPath(zones: Vector[String]): String = {
"zones/" + zones.mkString(",")
zones.map(zone => "zones/" + zone).mkString(" ")
}

// lowercase text to match gcp label requirements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class RunnableBuilderSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matc
runnable.getContainer.getCommandsList.asScala shouldBe expectedCommand
runnable.getAlwaysRun shouldBe true
runnable.getLabelsMap shouldBe memoryRetryRunnableExpectedLabels
runnable.getContainer.getVolumesList.asScala.toList shouldBe volumes.map(v => s"${v.getMountPath}:${v.getMountPath}:")
runnable.getContainer.getVolumesList.asScala.toList shouldBe volumes.map(v => s"${v.getMountPath}:${v.getMountPath}")
}

it should "return cloud sdk runnable for multiple keys in retry-with-double-memory" in {
Expand All @@ -89,6 +89,6 @@ class RunnableBuilderSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matc
runnable.getContainer.getCommandsList.asScala shouldBe expectedCommand
runnable.getAlwaysRun shouldBe true
runnable.getLabelsMap shouldBe memoryRetryRunnableExpectedLabels
runnable.getContainer.getVolumesList.asScala.toList shouldBe volumes.map(v => s"${v.getMountPath}:${v.getMountPath}:")
runnable.getContainer.getVolumesList.asScala.toList shouldBe volumes.map(v => s"${v.getMountPath}:${v.getMountPath}")
}
}

0 comments on commit 5bc7ac3

Please sign in to comment.