Alternative to parsing stdout

Many examples in WDL docs involve running a command that prints some output into stdout, and then harvesting this output from stdout() into a variable. For example:

    task hello {
      String pattern
      File in

      command {
        egrep '${pattern}' '${in}'
      }

      output {
        Array[String] matches = read_lines(stdout())
      }
    }

    workflow wf {
      call hello
    }  

However, on my PBS farm this approach fails, most likely due to some caching issues. I'm wondering what's the best way to mitigate this issue?

Thanks a lot!

Tagged:

Answers

  • RuchiRuchi Member, Broadie, Moderator, Dev admin

    Hey @msp_a11,

    I believe this is a rare type of failure. Out of curiosity, would you be able to share the Cromwell logs, to see if there are any errors are being thrown that could indicate what the root cause of the failure is?

    A different approach can be:

        task hello {
          String pattern
          File in
    
          command {
            egrep '${pattern}' '${in}' > test
          }
    
          output {
            Array[String] matches = read_lines("test")
          }
        }
    
        workflow wf {
          call hello
        }  
    

    If read_lines() doesn't work at all, we should get to the root of why it seems to fail due to caching.

    Thanks!

Sign In or Register to comment.