enitre "produce" block executes twice?

10 views
Skip to first unread message

mqualls

unread,
Aug 30, 2018, 4:39:27 PM8/30/18
to bpipe-discuss
I was using a FileTreeBuilder to set up some configuration files and kept finding the contents of the file were repeated. It turns out, the produce block it was in was running twice. This seems to happen to any produce block, such as in this minimal example:

test = {

       produce("a") {

               println "doing a"

               exec("echo a > a")

       }

}


Bpipe.run {

       test

}


"doing a" will print twice
This is using 0.9.9.6

Simon Sadedin

unread,
Aug 31, 2018, 2:33:53 AM8/31/18
to bpipe-discuss on behalf of Ryan
Hi,

Indeed it can get executed twice.

This could probably be made clearer in the documentation: in order to discover what outputs and inputs will be produced by the body of the produce statement, Bpipe will execute it in a mode where none of the "exec" statements do anything. So the exec will only happen once, but the code inside the produce block itself can execute twice. For this reason it's important that such code either be robust to that ("idempotent" in a sense - doing it twice is the same as doing it once).

Cheers,

Simon

--
You received this message because you are subscribed to the Google Groups "bpipe-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bpipe-discus...@googlegroups.com.
To post to this group, send email to bpipe-...@googlegroups.com.
Visit this group at https://groups.google.com/group/bpipe-discuss.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages