Skip to content

Commit a8c64c3

Browse files
committed
Allow describing wdl with zipped imports.
1 parent 430fc40 commit a8c64c3

File tree

18 files changed

+202
-24
lines changed

18 files changed

+202
-24
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
Cromwell now allows opting into configured soft links on shared file systems such as HPC environments. More details can
88
be found [here](https://cromwell.readthedocs.io/en/stable/backends/HPC/#optional-docker-soft-links).
99

10+
### `/describe` endpoint support for `workflowDependencies`
11+
12+
Previously it was not possible to describe a `workflowSource` that required `workflowDependencies` as the `/describe`
13+
endpoint did not allow specifying the additional zip file.
14+
15+
Now the endpoint will allow the user to upload the `workflowDependencies` zip file, will validate the top level
16+
workflow plus the dependencies, then return the appropriate response including the defined workflow inputs and outputs.
17+
1018
## 87 Release Notes
1119

1220
### `upgrade` command removed from Womtool

CromIAM/src/main/resources/swagger/cromiam.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,11 @@ paths:
838838
required: false
839839
type: file
840840
in: formData
841+
- name: workflowDependencies
842+
description: ZIP file containing workflow source files that are used to resolve local imports. This zip bundle will be unpacked in a sandbox accessible to this workflow.
843+
required: false
844+
type: file
845+
in: formData
841846
- $ref: '#/parameters/workflowTypeParam'
842847
- $ref: '#/parameters/workflowTypeVersionParam'
843848
responses:

centaur/src/main/scala/centaur/test/Test.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,7 @@ object Operations extends StrictLogging {
244244
}
245245

246246
override def run: IO[Unit] =
247-
// We can't describe workflows based on zipped imports, so don't try:
248-
if (workflow.skipDescribeEndpointValidation || workflow.data.zippedImports.nonEmpty) {
247+
if (workflow.skipDescribeEndpointValidation) {
249248
IO.pure(())
250249
} else {
251250
checkDescriptionInner(0)

centaur/src/main/scala/centaur/test/workflow/Workflow.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ final case class Workflow private (testName: String,
4545
workflowUrl = data.workflowUrl,
4646
workflowType = data.workflowType,
4747
workflowTypeVersion = data.workflowTypeVersion,
48-
inputsJson = data.inputs.map(_.unsafeRunSync())
48+
inputsJson = data.inputs.map(_.unsafeRunSync()),
49+
zippedImports = data.zippedImports
4950
)
5051

5152
def secondRun: Workflow =

cromwellApiClient/src/main/scala/cromwell/api/CromwellClient.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,13 @@ object CromwellClient {
266266
Multipart.FormData.BodyPart(name, HttpEntity(MediaTypes.`application/json`, ByteString(source)))
267267
}
268268

269-
val multipartFormData = Multipart.FormData(sourceBodyParts.toSeq: _*)
269+
val zipBodyParts = Map(
270+
"workflowDependencies" -> describeRequest.zippedImports
271+
) collect { case (name, Some(file)) =>
272+
Multipart.FormData.BodyPart.fromPath(name, MediaTypes.`application/zip`, file.path)
273+
}
274+
275+
val multipartFormData = Multipart.FormData((sourceBodyParts ++ zipBodyParts).toSeq: _*)
270276
multipartFormData.toEntity()
271277
}
272278

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package cromwell.api.model
22

3+
import better.files.File
4+
35
final case class WorkflowDescribeRequest(workflowSource: Option[String],
46
workflowUrl: Option[String],
57
workflowType: Option[String],
68
workflowTypeVersion: Option[String],
7-
inputsJson: Option[String]
9+
inputsJson: Option[String],
10+
zippedImports: Option[File]
811
)

docs/api/RESTAPI.md

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

engine/src/main/resources/swagger/cromwell.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,11 @@ paths:
662662
required: false
663663
type: file
664664
in: formData
665+
- name: workflowDependencies
666+
description: ZIP file containing workflow source files that are used to resolve local imports. This zip bundle will be unpacked in a sandbox accessible to this workflow.
667+
required: false
668+
type: file
669+
in: formData
665670
- $ref: '#/parameters/workflowTypeParam'
666671
- $ref: '#/parameters/workflowTypeVersionParam'
667672
responses:

engine/src/main/scala/cromwell/webservice/routes/WomtoolRouteSupport.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ trait WomtoolRouteSupport extends WebServiceUtils with GithubAuthVendingSupport
6060
val workflowInputs = data.get("workflowInputs").map(_.utf8String)
6161
val workflowType = data.get("workflowType").map(_.utf8String)
6262
val workflowVersion = data.get("workflowTypeVersion").map(_.utf8String)
63+
val workflowDependencies = data.get("workflowDependencies").map(_.toArray)
6364

6465
val wsfc = WorkflowSourceFilesCollection(
6566
workflowSource,
@@ -70,7 +71,7 @@ trait WomtoolRouteSupport extends WebServiceUtils with GithubAuthVendingSupport
7071
workflowInputs.getOrElse(""),
7172
workflowOptions = WorkflowOptions.empty,
7273
labelsJson = "",
73-
importsFile = None,
74+
importsFile = workflowDependencies,
7475
workflowOnHold = false,
7576
warnings = Seq.empty,
7677
requestedWorkflowId = None

engine/src/test/scala/cromwell/webservice/routes/CromwellApiServiceSpec.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,9 @@ object CromwellApiServiceSpec {
761761
s"[reading back DescribeRequest contents] workflow url: ${sourceFiles.workflowUrl}",
762762
s"[reading back DescribeRequest contents] inputs: ${sourceFiles.inputsJson}",
763763
s"[reading back DescribeRequest contents] type: ${sourceFiles.workflowType}",
764-
s"[reading back DescribeRequest contents] version: ${sourceFiles.workflowTypeVersion}"
764+
s"[reading back DescribeRequest contents] version: ${sourceFiles.workflowTypeVersion}",
765+
s"[reading back DescribeRequest contents] dependencies: ${sourceFiles.importsZipFileOption
766+
.map(bytes => bytes.map(b => "0x%02X".format(b)).mkString("[", ", ", "]"))}"
765767
)
766768

767769
sender() ! DescribeSuccess(description =

0 commit comments

Comments
 (0)