3

Is there a way to enter browser mode in a parallel foreach call? I've tried to create a cluster using manual = TRUE. As expected, it requires me to manually launch instances of R. However, once the instance receive a task from the master process, its off the the races and doesn't seem to pause at the browser() command. I'd like to enter browser and inspect the state of R.

foreach( i = 1 : 5 ) %dopar% 
{
     browser()
}

Here's the Rscript call in manual mode:

c:/.../bin/x64/Rscript" -e "parallel:::.slaveRSOCK()" MASTER=localhost PORT=10187 OUT= TIMEOUT=2592000 METHODS=TRUE
Suraj
  • 35,905
  • 47
  • 139
  • 250

2 Answers2

0

Though it's not stated in ?browser, I would expect that browser only works in interactive sessions.

Joshua Ulrich
  • 173,410
  • 32
  • 338
  • 418
0

The solution is to use manual = TRUE, load new instances of R (one for each node in your cluster), and execute the following:

timeout = 2592000
parallel:::.slaveRSOCK()

So basically ignore the RScript instructions.

Suraj
  • 35,905
  • 47
  • 139
  • 250