Skip to content

Commit 1d1c815

Browse files
committed
Allow describing wdl with zipped imports.
1 parent b1ec16a commit 1d1c815

File tree

18 files changed

+201
-22
lines changed

18 files changed

+201
-22
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ For more information, see the [Cromwell 79 release notes](https://github.com/bro
6565

6666
* Cromwell now attempts to translate `disks` attributes [written for GCP](https://cromwell.readthedocs.io/en/stable/RuntimeAttributes/#disks) into valid `disk` attributes for TES. For information on supported conversions, refer to the [TES documentation](https://cromwell.readthedocs.io/en/stable/backends/TES/).
6767

68+
### `/describe` endpoint support for `workflowDependencies`
69+
70+
Previously it was not possible to describe a `workflowSource` that required `workflowDependencies` as the `/describe`
71+
endpoint did not allow specifying the additional zip file.
72+
73+
Now the endpoint will allow the user to upload the `workflowDependencies` zip file, will validate the top level
74+
workflow plus the dependencies, then return the appropriate response including the defined workflow inputs and outputs.
75+
6876
### Bug Fixes
6977

7078
* Reference disks are only mounted if configured in the workflow options.

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
@@ -228,8 +228,7 @@ object Operations extends StrictLogging {
228228
override def run: IO[Unit] = {
229229

230230

231-
// We can't describe workflows based on zipped imports, so don't try:
232-
if (workflow.skipDescribeEndpointValidation || workflow.data.zippedImports.nonEmpty) {
231+
if (workflow.skipDescribeEndpointValidation) {
233232
IO.pure(())
234233
} else {
235234
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
@@ -43,7 +43,8 @@ final case class Workflow private(testName: String,
4343
workflowUrl = data.workflowUrl,
4444
workflowType = data.workflowType,
4545
workflowTypeVersion = data.workflowTypeVersion,
46-
inputsJson = data.inputs.map(_.unsafeRunSync())
46+
inputsJson = data.inputs.map(_.unsafeRunSync()),
47+
zippedImports = data.zippedImports,
4748
)
4849

4950
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
@@ -261,7 +261,13 @@ object CromwellClient {
261261
Multipart.FormData.BodyPart(name, HttpEntity(MediaTypes.`application/json`, ByteString(source)))
262262
}
263263

264-
val multipartFormData = Multipart.FormData(sourceBodyParts.toSeq : _*)
264+
val zipBodyParts = Map(
265+
"workflowDependencies" -> describeRequest.zippedImports
266+
) collect {
267+
case (name, Some(file)) => Multipart.FormData.BodyPart.fromPath(name, MediaTypes.`application/zip`, file.path)
268+
}
269+
270+
val multipartFormData = Multipart.FormData((sourceBodyParts ++ zipBodyParts).toSeq : _*)
265271
multipartFormData.toEntity()
266272
}
267273

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +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],
11+
)

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
@@ -642,6 +642,11 @@ paths:
642642
required: false
643643
type: file
644644
in: formData
645+
- name: workflowDependencies
646+
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.
647+
required: false
648+
type: file
649+
in: formData
645650
- $ref: '#/parameters/workflowTypeParam'
646651
- $ref: '#/parameters/workflowTypeVersionParam'
647652
responses:

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ trait WomtoolRouteSupport extends WebServiceUtils {
4545
val workflowInputs = data.get("workflowInputs").map(_.utf8String)
4646
val workflowType = data.get("workflowType").map(_.utf8String)
4747
val workflowVersion = data.get("workflowTypeVersion").map(_.utf8String)
48+
val workflowDependencies = data.get("workflowDependencies").map(_.toArray)
4849

4950
val wsfc = WorkflowSourceFilesCollection(
5051
workflowSource,
@@ -55,7 +56,7 @@ trait WomtoolRouteSupport extends WebServiceUtils {
5556
workflowInputs.getOrElse(""),
5657
workflowOptions = WorkflowOptions.empty,
5758
labelsJson = "",
58-
importsFile = None,
59+
importsFile = workflowDependencies,
5960
workflowOnHold = false,
6061
warnings = Seq.empty,
6162
requestedWorkflowId = None

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,12 @@ object CromwellApiServiceSpec {
670670
s"[reading back DescribeRequest contents] workflow url: ${sourceFiles.workflowUrl}",
671671
s"[reading back DescribeRequest contents] inputs: ${sourceFiles.inputsJson}",
672672
s"[reading back DescribeRequest contents] type: ${sourceFiles.workflowType}",
673-
s"[reading back DescribeRequest contents] version: ${sourceFiles.workflowTypeVersion}"
673+
s"[reading back DescribeRequest contents] version: ${sourceFiles.workflowTypeVersion}",
674+
s"[reading back DescribeRequest contents] dependencies: ${
675+
sourceFiles.importsZipFileOption.map(bytes =>
676+
bytes.map(b => "0x%02X".format(b)).mkString("[", ", ", "]")
677+
)
678+
}",
674679
)
675680

676681
sender() ! DescribeSuccess(description = WorkflowDescription(valid = true, errors = readBack, validWorkflow = true))

0 commit comments

Comments
 (0)