cromwell
cromwell copied to clipboard
basename() fails on required variable
Made a new ticket for this since it's a new issue. basename() does not work on optional values, but sometimes it seems to think things that aren't optional are optional.
This passes miniwdl and Cromwell, ie, is expected behavior:
version 1.0
task T {
input {
File? tsv_file_input
String tsv_arg = if defined(tsv_file_input) then basename(select_first([tsv_file_input, "/path/to/file.txt"])) else ""
}
command <<<
echo ~{tsv_arg}
>>>
}
workflow W {
input {
File? tsv_file_input
}
call T {
input:
tsv_file_input = tsv_file_input
}
}
This passes miniwdl, but fails Cromwell, even though it really ought to pass both:
version 1.0
task T {
input {
File? tsv_file_input
String foo = select_first([tsv_file_input, "/path/to/file.txt"])
String tsv_arg = if defined(tsv_file_input) then basename(foo) else ""
}
command <<<
echo ~{tsv_arg}
>>>
}
workflow W {
input {
File? tsv_file_input
}
call T {
input:
tsv_file_input = tsv_file_input
}
}
Cromwell's error is:
14:27:13.383 [main] ERROR io.dockstore.client.cli.ArgumentUtility - Problem parsing WDL file: Failed to process task definition 'T' (reason 1 of 1): Failed to process expression 'select_first([tsv_arg, if defined(tsv_file_input) then basename(foo) else ""])' (reason 1 of 1): Invalid parameter 'IdentifierLookup(foo)'. Expected 'File' but got 'String?' 14:27:13.385 [main] ERROR io.dockstore.client.cli.ArgumentUtility - wdl.draft3.parser.WdlParser$SyntaxError: Failed to process task definition 'T' (reason 1 of 1): Failed to process expression 'select_first([tsv_arg, if defined(tsv_file_input) then basename(foo) else ""])' (reason 1 of 1): Invalid parameter 'IdentifierLookup(foo)'. Expected 'File' but got 'String?'
Originally posted by @aofarrel in https://github.com/broadinstitute/cromwell/issues/6840#issuecomment-1245982086