Skip to content

Commit 5d14beb

Browse files
AlexITCaednichols
andauthored
WX-1595 Port more tests from papi-common to the GCP Batch backend (#7413)
Co-authored-by: Adam Nichols <anichols@broadinstitute.org>
1 parent 101dd32 commit 5d14beb

File tree

6 files changed

+842
-34
lines changed

6 files changed

+842
-34
lines changed

supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/models/GcpBatchWorkflowPaths.scala

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
11
package cromwell.backend.google.batch.models
22

3-
import com.google.api.gax.retrying.RetrySettings
43
import com.google.auth.Credentials
54
import com.typesafe.config.Config
65
import cromwell.backend.google.batch.models.GcpBatchWorkflowPaths.callCachePathPrefixFromExecutionRoot
76
import cromwell.backend.google.batch.runnable.WorkflowOptionKeys
87
import cromwell.backend.io.WorkflowPaths
98
import cromwell.backend.{BackendJobDescriptorKey, BackendWorkflowDescriptor}
10-
import cromwell.cloudsupport.gcp.gcs.GcsStorage
119
import cromwell.core.WorkflowOptions
1210
import cromwell.core.path.Path
1311
import cromwell.core.path.PathFactory.PathBuilders
14-
import cromwell.filesystems.gcs.GcsPathBuilder
1512

1613
import scala.concurrent.ExecutionContext
17-
import scala.language.postfixOps
1814

1915
object GcpBatchWorkflowPaths {
2016
val GcsRootOptionKey = "gcp_batch_gcs_root"
21-
private val AuthFilePathOptionKey = "auth_bucket"
2217
private val GcsPrefix = "gs://"
2318

24-
private def callCachePathPrefixFromExecutionRoot(executionRoot: String): String =
19+
private[models] def callCachePathPrefixFromExecutionRoot(executionRoot: String): String =
2520
// If the root looks like gs://bucket/stuff-under-bucket this should return gs://bucket
2621
GcsPrefix + executionRoot.substring(GcsPrefix.length).takeWhile(_ != '/')
2722
}
@@ -46,34 +41,6 @@ case class GcpBatchWorkflowPaths(workflowDescriptor: BackendWorkflowDescriptor,
4641

4742
private val workflowOptions: WorkflowOptions = workflowDescriptor.workflowOptions
4843

49-
val gcsAuthFilePath: Path = {
50-
// The default auth file bucket is always at the root of the root workflow
51-
val defaultBucket = executionRoot
52-
.resolve(workflowDescriptor.rootWorkflow.name)
53-
.resolve(workflowDescriptor.rootWorkflowId.toString)
54-
val bucket = workflowDescriptor.workflowOptions
55-
.get(GcpBatchWorkflowPaths.AuthFilePathOptionKey) getOrElse defaultBucket.pathAsString
56-
57-
/*
58-
* This is an "exception". The filesystem used here is built from batchAuth
59-
* unlike everywhere else where the filesystem used is built from gcsFileSystemAuth
60-
*/
61-
val pathBuilderWithBatchAuth = GcsPathBuilder.fromCredentials(
62-
batchCredentials,
63-
gcpBatchConfiguration.googleConfig.applicationName,
64-
RetrySettings.newBuilder().build(),
65-
GcsStorage.DefaultCloudStorageConfiguration,
66-
workflowOptions,
67-
Option(gcpBatchConfiguration.batchAttributes.project)
68-
)
69-
70-
val authBucket = pathBuilderWithBatchAuth.build(bucket) recover { case ex =>
71-
throw new Exception(s"Invalid gcs auth_bucket path $bucket", ex)
72-
} get
73-
74-
authBucket.resolve(s"${workflowDescriptor.rootWorkflowId}_auth.json")
75-
}
76-
7744
val monitoringScriptPath: Option[Path] = workflowOptions.get(WorkflowOptionKeys.MonitoringScript).toOption map {
7845
path =>
7946
// Fail here if the path exists but can't be built
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"manifestFormatVersion": 2,
3+
"dockerImageCacheMap": {
4+
"project1/dockerImage1": {
5+
"dockerImageDigest": "sha256:c73e11b1a7854f31ff12c607738bef7b0560a880dc9d0445dde084acc0e9da09",
6+
"diskImageName": "projects/some-google-project/global/images/dockerCacheDiskForDockerImage1"
7+
},
8+
"project2/dockerImage2": {
9+
"dockerImageDigest": "sha256:7eb386481d87e41ebddceb948f25379bb339784df5247a3dfbdea2ac101b10c0",
10+
"diskImageName": "projects/another-google-project/global/images/dockerCacheDiskForDockerImage2"
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)