Code Runner with R

Re: Code Runner with R

by Richard Lobb -
Number of replies: 0
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?