Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rscript running trouble with TMPDIR via plink -ssh on Windows

Tags:

ssh

r

tempdir

plink

I want to create my own variant of makePSOCKcluster and newPSOCKnode using ssh connection via plink. So, I rewrite code

    if (machine != "localhost") {
        rshcmd <- getClusterOption("rshcmd", options)
        user <- getClusterOption("user", options)
        cmd <- shQuote(cmd)
        cmd <- paste(rshcmd, "-l", user, machine, cmd)
    }
    if (.Platform$OS.type == "windows") {
        system(cmd, wait = FALSE, input = "")
    }
    else system(cmd, wait = FALSE)

by my variant, which gives me cmd like this:

plink -ssh Rebelion@ClusterNode1 -pw myPasswd123 "Rscript --default-packages=datasets,utils,grDevices,stats,graphics,methods -e parallel!:::.slaveRSOCK MASTER=CLUSTERNODE1 PORT=11038 TIMEOUT=2592000 XDR=TRUE". 

ClusterNode1 here is a current machine (I logged as Rebelion, it's an administrator login).

But system(cmd, wait=FALSE, input="") gives me this:

Fatal error: creation of tmpfile failed -- set TMPDIR suitably?

I don't know why I get this error and what should I do. I set TMPDIR, TMP and TEMP variables as %USERPROFILE%/AppData/Local/Temp, I set privilegies on maximum for all kind of users except guests.

Could anyone helps me to solve this problem? Thnxs.

like image 414
Dmitriy Avatar asked Feb 21 '17 23:02

Dmitriy


3 Answers

The TMPDIR must be an actual path, like C:\Users\martin\AppData\Local\Temp.

It cannot contain another environment variables.

like image 75
Martin Prikryl Avatar answered Nov 04 '22 23:11

Martin Prikryl


Use system2 call and pass TMPDIR variable using env argument.

From documentation:

system2(command, args = character(), stdout = "", stderr = "", stdin = "", input = NULL, env = character(), wait = TRUE, minimized = FALSE, invisible = TRUE)

env: character vector of name=value strings to set environment variables.

Also, try giving the TMPDIR path as an absolute path, such as C:\Windows\Temp, instead of using CMD environment variables.

like image 29
Olli Avatar answered Nov 04 '22 21:11

Olli


This looks like an issue with your login startup setting on that remote machine. I would try to get the following to work (from the Windows command prompt):

plink -ssh Rebelion@ClusterNode1 -pw myPasswd123 "Rscript --version"

and if that works, make sure:

plink -ssh Rebelion@ClusterNode1 -pw myPasswd123 "Rscript -e 1+2"

also works. Only then, start worrying about doing this with the parallel package in R.

like image 21
HenrikB Avatar answered Nov 04 '22 21:11

HenrikB