futureverse / parallelly

R package: parallelly - Enhancing the 'parallel' Package
https://parallelly.futureverse.org
130 stars 7 forks source link

makeNodePSOCK(): Make revtunnel=NA agile to argument 'rshcmd' #84

Closed HenrikBengtsson closed 2 years ago

HenrikBengtsson commented 2 years ago

Argument revtunnel control reverse tunneling for SSH. It only makes sense when SSH is used for launching workers. If another command is used, it revtunnel should be FALSE. For example, with the new "PJM", we want to use rshcmd = "pjrsh", but this forces us to also manually specify revtunnel = FALSE;

cl <- parallelly::makeClusterPSOCK(workers, rshcmd = "pjrsh", revtunnel = FALSE)

Ideally, it would be sufficient to do:

cl <- parallelly::makeClusterPSOCK(workers, rshcmd = "pjrsh")

which can also be done as:

options(parallelly.makeNodePSOCK.rshcmd = "pjrsh")
cl <- parallelly::makeClusterPSOCK(workers)

or

$ export R_PARALLELLY_MAKENODEPSOCK_RSHCMD="pjrsh"
$ R
...
cl <- parallelly::makeClusterPSOCK(workers)

Suggestion

Make revtunnel = NA the new default, and if NA, then look at the rshcmd argument to infer if ssh is used. The gist is that it can look at tolower(basename(rshcmd[1])) %in% "ssh", but also needs to be agile to PuTTY and likes.