Code Runner with R

Code Runner with R

by Martin Rosalie -
Number of replies: 1

Dear all,

First, thank you for your work, it's amazing. I am using code runner to evaluate students code in R for a year now, it's perfect.

I manage to get R 4.2 available for jobe. I had an issue regarding jobe user when R start.

In normalizePath("~") : path[1]="/home/jobe00": No such file or directory

I read the following sentence here (

"The Jobe installer sets the access rights to the various Jobe folders and you should not need to change these. If you do so, you risk opening major security holes. Each Jobe task runs as a different Jobe user (jobe00, jobe01 etc) and each is isolated from all the others to avoid information leakage between users. Jobe does however depend on ACL (Access Control List) support being enabled so if that's not enabled on your server you won't be able to run Jobe."

Last year, to make my code runner questions working: my admin had to create a jobe00 folder with access for jobe user. I was working perfectly.

This year, I had a similar issue with

Warning message:
In normalizePath("~") : path[1]="/home/jobe01": No such file or directory

I suppose this occurs because another jobe user has been created to run my questions. It happens when more than 10 students work in parallel.

Consequently, does it means that I have to ask my admin to create joeb01, jobe02 ? Is it enough to handle numerous (and in parallel) runs of code runner questions ?

An alternative is to find the Rscript good option to indicates to jobe user folder. I tried to figure out what is my best option (from here

  • --no-environ does not allow me to load tidyverse library (so I reject this option)
  • --no-init-file will look for user file, so again maybe jobe01 will appear to be missing ?
Can you tell me if I am right or wrong about my reasoning ? Is it a good solution to have multiple R folder for each jobe user (jobe00, jobe01, ...) ?
Best regards,
In reply to Martin Rosalie

Re: Code Runner with R

by Richard Lobb -
I'm not an R user myself and haven't used it in a production system, so can't comment on the feasibility of running R without a home directory, but your reasoning all sounds good to me.

I don't quite understand what you mean when you say "It happens when more than 10 students work in parallel." Even if only two students are submitting at the same time, there would be two jobe tasks running. If R requires users to have a home directory, I'd have expected that you'd get that message for the second user. However, if your R tasks are running very quickly and the Moodle + Apache + communication overheads are dominant, the actual level of R parallelism might be much less than the level of parallelism as perceived by the users.

If you need a home directory for jobe00, then you should have home directories for all the other Jobe users. The number of Jobe users depends on a configuration constant but defaults to either 12 or 8 depending on when your Jobe system was built.

BUT ... please realise that there's security risk in having home directories. Jobe is meant to be a stateless server, i.e. each jobe task runs independently of all others and does not cause any server state changes (except for file caching for efficiency). As soon as you provide home directories, you open the possibility that a student can leave code or data behind in a jobe home directory which can then be accessed later by that user or other users. It is also possible for data to accumulate in the home directory which might ultimately lead to disk space exhaustion.That's why Jobe is set up without home directories.

You could mitigate the risks by adding to your template code that deletes the entire contents of the home directory at the start and/or the end of each run. But still leaves open a security hole for users of other languages and question types.

Despite the above warnings, though, the risks associated with having home directories are probably pretty low. Every job run on CodeRunner is logged by Moodle - not only the user name but the quiz, time, code run etc. So if you were to become aware of exploits using home directories you should be able to track down who was doing it.

Really, though, you want to find a way to run R without home directories. Perhaps it does actually work fine, and all you need to do is change the template to strip out the warning message and ignore it?