Question Authors' Forum

Sandbox doesn't work

Sandbox doesn't work

von Sarah Becker -
Anzahl Antworten: 6

Hi everyone :)

For several days I've now been trying to set up a Moodle installation with CodeRunner. 
Unfortunately I'm not getting anywhere and at this point.
The problem I have is, that I'm getting the error message already mentions by other people in this forum:

Unexpected error while executing your code. The sandbox server may be down or overloaded. Perhaps try again shortly.

(or in my case - as my installation is in German: "Ein unerwarteter Fehler ist aufgetreten. Die Sandbox ist möglicherweise nicht verfügbar. Versuchen Sie es bald noch einmal.")

I've set up a jobeinabox in a Docker container on my linux server. And if I try http://[my-host]:4000/jobe/index.php/restapi/languages

I get: 

[["c","9.3.0"],["cpp","9.3.0"],["java","14.0.2"],["nodejs","10.19.0"],["octave","5.2.0"],["pascal","3.0.4"],["php","7.4.3"],["python3","3.8.10"]]

In the coderunner settings, I've set:
[my-host]:4000

The API key I left empty, as this isn't supported by jobeinabox

When I run the testfile on the server:
sudo docker exec -t jobe /usr/bin/python3 /var/www/html/jobe/testsubmit.py

Everything seems to work, except for one test:


***************** FAILED TEST ******************

{'run_id': None, 'outcome': 15, 'cmpinfo': '', 'stdout': 'Unable to create directory /home/jobe/runs/jobe_6I2mM7/Hom  e/.cache/pylint\n', 'stderr': ''}
Valid Python3/pylint program
Jobe result: Successful run

Output:
Unable to create directory /home/jobe/runs/jobe_6I2mM7/Home/.cache/pylint


************************************************

I'm really at a loss at what to do now. I don't even know where I could look for the error.

I really hope, someone can help.

Thanks in advance.

Kind regards, Sarah

Als Antwort auf Sarah Becker

Re: Sandbox doesn't work

von Richard Lobb -

Hi Sarah

Sorry this is proving so frustrating. I don't understand the error you get with pylint when running testsubmit but I doubt it's relevant to the main problem so let's ignore that for now.

I'm assuming you're running the docker jobeinabox container within the Moodle server and that CodeRunner works OK with the default University of Canterbury jobe server, right?

If that's the case, the usual culprit in such errors is networking. You say

In the coderunner settings, I've set:
[my-host]:4000
How are you naming my-host here? Using the full external domain name of your host may not work from within the host, so I recommend trying both localhost:4000 and 127.0.0.1:4000

If that's not the problem, run the attached testsubmit.py program on your Moodle server with the command

python3 testsubmit.py
Also, as a double check, edit line 52, currently

JOBE_SERVER = 'localhost:4000'

to 

JOBE_SERVER = '127.0.0.1:4000'

and check that too. Let me know what you get.

-- Richard

Als Antwort auf Richard Lobb

Re: Sandbox doesn't work

von Sarah Becker -

Hi Richard,

Thank you for answering that quickly.

Standard settings don't work either - get the same error there. Actually: I first got the error with the standard settings and only then realized, I had to set up my own jobe instance.

As for jobeinabox - it's running on a completely different machine. The moodle site is hosted and jobeinabox sits in a docker container on a Debian server in my local network. I have a static IP here and I've tried both - using the hostname (got one at dyn.com) and the IP directly.

About the testsubmit.py file - should I copy it into my docker-instance and run it from there? OR where should I put it? If I have to place it on the server Moodle is running on, where exactly would I place it there?

I'll try around a bit more, but if you have any ideas, I'd be really greatful.



Als Antwort auf Sarah Becker

Re: Sandbox doesn't work

von Richard Lobb -

If the standard settings don't work either you almost certainly have a networking problem. The standard settings should work out of the box unless something is getting in the way, network wise. Who manages the Moodle server? I'd say it's almost certainly firewalled in some way, perhaps through being behind a proxy server that is preventing the required outgoing connection.

Are you able to run a shell on the Moodle server. If so I think you'll find that the following commands, which should both work, give errors:

wget --header="X-API-Key: 2AAA7A5415B4A9B394B54BF1D2E9D" jobe2.cosc.canterbury.ac.nz/jobe/index.php/restapi/languages
wget [yourjobeinaboxserver]:4000/jobe/index.php/restapi/languages

The error messages might tell you something useful. Or you might have to talk to your network administrator.

Richard


Als Antwort auf Richard Lobb

Re: Sandbox doesn't work

von Sarah Becker -
Hi Richard

The Moodle site ist hosted on a shared webspace (so not my server), but I do have limited SSH access.
I ran both commands and they worked flawlessly.

Then I got into thinking: All the time worked with an example course I found online (because I wanted to get to know CodeRunner a little bit before I try to create my own questions) - maybe the problem is there?

So I created a new quiz with just your sqr(n) example in it - and it worked! *heureka*

Now I've deleted the demo course - and just be sure, reimported it. I've no idea what went wrong in the first place, but now everything works fine, as far as I can tell.

Thank you very much for taking the time to answer and helping me. And thank you of course for this brilliant plugin!

All the best, 
Sarah
Als Antwort auf Sarah Becker

Re: Sandbox doesn't work

von Richard Lobb -

Hi Sarah

Great to know the problem is solved, though like you I'm baffled as to what caused it in the first place. I wouldn't have thought an imported course could create that sort of problem unless it was using custom question types that didn't work on a generic Jobe server. If you ever figure it out, please let me know.

It sounds like all is now OK, except I think you still have a problem with pylint on Jobe, since one of the tests failed when you ran testsubmit.py? We can look into that if you need pylint. I'm puzzled by it, because jobeinthebox containers should behave the same for everyone. Or so I thought.

Hope you enjoy CodeRunner.

Richard

Als Antwort auf Richard Lobb

Re: Sandbox doesn't work

von Sarah Becker -

Hi Richard

Yes, I'm very glad the problem was resolved in the end. If I ever find out what caused it, I'll let you know.

As for the pylint problem. At the moment I don't find the time to look into it and it's not that urgent. Thank you very much for your offer though. If I really don't find a solution on my own, I might appreciate some more help.

Thank you again for your great support

Kind regards,

Sarah