cromwell icon indicating copy to clipboard operation
cromwell copied to clipboard

womtool passes WDL workflow, cromwell gives "No coercion" error

Open Redmar-van-den-Berg opened this issue 5 years ago • 2 comments

I ran into the following problem when upgrading from cromwell 31.1 to 36. It looks like in cromwell 31.1, it is possible to pass a single File to a task that expects an Array[File]. In cromwell 36 however, this gives the following error: Failed to evaluate input 'files' (reason 1 of 1): No coercion defined from wom value(s) '"cromwell-36.jar"' of type 'File' to 'Array[File]'. However, both womtool 31.1 and womtool 36 give no errors when validating the workflow

I'm not sure which of the two is the correct behaviour according to the WDL spec, but I think womtool and cromwell should agree on whether or not the wdl file is valid or not.

Cromwell Womtool 31

$ java -jar womtool-31.jar validate wf.wdl 

$ java -jar cromwell-31.1.jar run --inputs wf.json wf.wdl 
[2019-01-15 15:07:53,81] [info] Running with database db.url = jdbc:hsqldb:mem:6b74f862-dc18-4cf1-8e2e-0b9002bba0bf;shutdown=false;hsqldb.tx=mvcc
.
.
[2019-01-15 15:08:11,54] [info] WorkflowExecutionActor-977d0c47-9cf5-4893-8dcf-465c27da13d7 [977d0c47]: Workflow wf complete. Final Outputs:
{
"wf.F": [["/home/redmar/devel/wdl/test/issue/cromwell-executions/wf/977d0c47-9cf5-4893-8dcf-465c27da13d7/call-ls/shard-0/inputs/home/redmar/devel/wdl/test/issue/cromwell-31.1.jar"], ["/home/redmar/devel/wdl/test/issue/cromwell-executions/wf/977d0c47-9cf5-4893-8dcf-465c27da13d7/call-ls/shard-1/inputs/home/redmar/devel/wdl/test/issue/cromwell-36.jar"], ["/home/redmar/devel/wdl/test/issue/cromwell-executions/wf/977d0c47-9cf5-4893-8dcf-465c27da13d7/call-ls/shard-2/inputs/home/redmar/devel/wdl/test/issue/womtool-31.jar"], ["/home/redmar/devel/wdl/test/issue/cromwell-executions/wf/977d0c47-9cf5-4893-8dcf-465c27da13d7/call-ls/shard-3/inputs/home/redmar/devel/wdl/test/issue/womtool-36.jar"]]
}

Cromwell Womtool 36

$ java -jar womtool-36.jar validate wf.wdl 

$ java -jar cromwell-36.jar run --inputs wf.json wf.wdl 
[2019-01-15 15:09:17,10] [info] Running with database db.url = jdbc:hsqldb:mem:e77f2c21-f28a-4571-ba89-d915b85b25fc;shutdown=false;hsqldb.tx=mvcc
[2019-01-15 15:09:22,59] [info] Running migration RenameWorkflowOptionsInMetadata with a read batch size of 100000 and a write batch size of 100000
[2019-01-15 15:09:22,60] [info] [RenameWorkflowOptionsInMetadata] 100%
[2019-01-15 15:09:22,67] [info] Running with database db.url = jdbc:hsqldb:mem:52af65c3-a08f-4d3a-a6bc-c97a3d7e1a3c;shutdown=false;hsqldb.tx=mvcc
[2019-01-15 15:09:22,97] [info] Slf4jLogger started
[2019-01-15 15:09:23,24] [info] Workflow heartbeat configuration:
{
"cromwellId" : "cromid-d961aae",
"heartbeatInterval" : "2 minutes",
"ttl" : "10 minutes",
"writeBatchSize" : 10000,
"writeThreshold" : 10000
}
.
.
[2019-01-15 15:09:29,85] [error] WorkflowManagerActor Workflow 5bc372e9-61f6-45fd-b178-60ed25529216 failed (during ExecutingWorkflowState): cromwell.engine.workflow.lifecycle.execution.job.preparation.JobPreparationActor$$anonfun$1$$anon$1: Call input and runtime attributes evaluation failed for ls:
Failed to evaluate input 'files' (reason 1 of 1): No coercion defined from wom value(s) '"womtool-31.jar"' of type 'File' to 'Array[File]'.
.
.
Workflow 5bc372e9-61f6-45fd-b178-60ed25529216 transitioned to state Failed

issue.zip

I've attached the wdl and json files I've used, the input filenames are the jar files of both cromwell and womtool used to run the test workflow. I'm not attaching those because they are very large.

Redmar-van-den-Berg avatar Jan 15 '19 14:01 Redmar-van-den-Berg

Hi @Redmar-van-den-Berg, you're correct, there appears to be a bug in our draft-2 parser which is failing to catch this.

To answer "which is correct", the requirement to wrap values in arrays was not being enforced correctly but it now is. In your example you can do this with the array literal syntax, eg:

        call ls {
            input: files = [ i ]
        }

I have added a test for our WDL 1.0 support which is catching this properly, so if you're able to upgrade your workflows from WDL draft-2 to WDL 1.0, then womtool validate will give you the correct answer. If not, I'll leave this open as a bug since it certainly should be picked up by womtool.

Thanks!

cjllanwarne avatar Jan 15 '19 20:01 cjllanwarne

I am running into the same bug on Terra. Not sure what version of Cromwell it is using. My wdl validates however, I get the a run time error

Failed to evaluate input 'fastq1' (reason 1 of 1): No coercion defined from wom value(s) '"gs://fc-secure-46b3886a-473a-49ef-8073-022230a526ac/6463b025-27cf-4649-b6d0-59f860bdf18b/bam2FastQStarAlignWorkflow/a4a0d2f2-cc8b-41d8-a5b5-61cf6c2d0bd4/call-bamToFastq/cacheCopy/GTEX-1192X-0011-R10a-SM-DO941.1.fastq.gz"' of type 'File' to 'Array[File]'.

adding '[' and ']' resolved the run time issue

call starWorkflow.star_fastq_list {
        input:
        star_index = starIndex,
        fastq1     = [ bamToFastq.firstEndFastq ],
        fastq2     = [ bamToFastq.secondEndFastq ],
        prefix     = sampleId
    }

aedavids avatar Jun 07 '22 17:06 aedavids