Rscript running trouble with TMPDIR via plink -ssh on Windows
Asked Answered
T

4

6

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.

Tsana answered 21/2, 2017 at 23:5 Comment(1)
Somehow system or plink command is not running with administrative privilage. Try to give everyone full permissions in configured temp directory and give it a shotUndertook
M
2

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

It cannot contain another environment variables.

Macrospore answered 2/3, 2017 at 20:37 Comment(0)
I
1

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.

Innocency answered 2/3, 2017 at 20:14 Comment(1)
The env sets the the environment variables for the executed subprocess. While for the OP the variable is missing for the current Rscript process.Macrospore
T
1

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.

Typewritten answered 7/3, 2017 at 2:8 Comment(0)
T
0

thank you. I don't know, how to give points to you all, sorry, but I really want to give a bounty to you all. Main problem was in OpenSSH and separate privilegies rule, which doesn't allow to create session with administrator's rights. Novaday I can run Rscript normally but have problem with parallel!:::.slaveRSOCK() part (I suppose, this is connected with separators and paths, I'll solve this problem soon too). Thank you again and again. If you know how to give bounty to you all - pls, say me, I'll do.

Tsana answered 10/3, 2017 at 8:26 Comment(2)
Good to hear you got it figured out! Sharing bounty between multiple answers isn't possible but one could award another bounty to the other award, see meta.https://mcmap.net/q/1913800/-event-handling-in-asp-net .Innocency
Can you clarify exactly what you mean by "I can run Rscript normally", e.g. show the full call you do from the command line and what the output is. That helps us to know where you are and what's missing.Typewritten

© 2022 - 2024 — McMap. All rights reserved.