I'm using doSnow and foreach to send a bunch of messages in parallel, but they are cluttering my logs making them difficult to parse. The simple example below:
library(foreach)
library(doSNOW)
numbers <- 1:6
cool_print <- function(x) print(paste0(x, " is cool"))
cl <- makeCluster(2, outfile="") # "" passes messages to standard out
registerDoSNOW(cl)
sns_responses <-
foreach(
x = numbers
) %dopar% {
cool_print(x)
}
stopCluster(cl)
Outputs the following:
Type: EXEC
Type: EXEC
Type: EXEC
Type: EXEC
[1] "1 is cool"
[1] "2 is cool"
Type: EXEC
[1] "3 is cool"
Type: EXEC
[1] "4 is cool"
Type: EXEC
[1] "5 is cool"
Type: EXEC
[1] "6 is cool"
> stopCluster(cl)
Type: DONE
Type: DONE
I just want it to print all of the " is cool" statements.
Can you do this? Is there an option I can set in Snow somewhere that allows printing, but not this other stuff?
snow
package (source code). – count orlok