Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WX-1340 GCP Batch: Mount with extra colon issue and multiple zones support #7240

Merged
merged 4 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@

trait BatchUtilityConversions {


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

Check warning on line 13 in supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/util/BatchUtilityConversions.scala

View check run for this annotation

Codecov / codecov/patch

supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/util/BatchUtilityConversions.scala#L13

Added line #L13 was not covered by tests
}

// 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}")
}
}
Loading