Skip to content

Creating a Remote Plan when R is in an Environment Module #648

Answered by HenrikBengtsson
lpiep asked this question in Q&A
Discussion options

You must be logged in to vote

Hello. I think the easiest approach is to create a custom shell script that replaces Rscript when it comes to launching the R worker. Assuming you use Bash as your shell script on the remote system, create a myRscript script like:

#! /usr/bin/env bash

## Load the 'r' module
module load r

## Call Rscript and pass all arguments as-is
Rscript "$@"

Make sure it's executable, i.e. do:

{remote}$ chmod ugo+x myRscript

Verify it works;

{remote}$ ~/myScript --version
Rscript (R) version 4.2.1 (2022-06-23)

{remote}$ ~/myRscript -e "getRversion()"
[1] ‘4.2.1’

and also from your local computer, e.g.

{laptop}$ ssh remote.server.com '~/myRscript -e "getRversion()"'
[1] ‘4.2.1’

When you've verified a…

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@HenrikBengtsson
Comment options

@lpiep
Comment options

@HenrikBengtsson
Comment options

@lpiep
Comment options

@HenrikBengtsson
Comment options

Answer selected by lpiep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants