How to generate Array[File] output of variable size?

markwmarkw Cambridge, MAMember, Broadie, Moderator, Dev admin

I have a task that returns an Array[File] whose size is set by an input integer, like this:

task MyTask {
  Int size
  String dollar = "$" #workaround to access bash variables, see issue #1819
  command <<<
    for i in {0...${size}}; do
      echo "This is file ${dollar}{i}" > ${dollar}{i}.txt
      echo "${dollar}{i}.txt" >> output_files.txt
  output {
    Array[File] files = read_lines("output_files.txt")

Using Cromwell 30 with JES, "output_files.txt" gets delocalized to the bucket instead of the actual files 0.txt, 1.txt, 2.txt, etc. Is this intentional behavior or a bug? Is there any other way to approach this problem?

Thank you.

Best Answer


Sign In or Register to comment.