Developers' Forum

Jobe Server on a Raspberry Pi

Jobe Server on a Raspberry Pi

by Michael Backus -
Number of replies: 6

I think I'm going to take the plunge and start using CodeRunner. Looks like I'll need to setup a Jobe Server. Would it be practical to set it up on a Raspberry Pi (at least to start with). If so, anything special I should take into consideration when setting it up?

In reply to Michael Backus

Re: Jobe Server on a Raspberry Pi

by Richard Lobb -

I'm skeptical about running Jobe on a Pi. It might be possible but for a cost of $3 per month you can run it a Digital Ocean server: there's a video walkthrough here.

That said, Jobe may work on a Pi, although I doubt it'll be entirely straightforward to set it up. One problem you'll definitely have to deal with is that Raspbian doesn't have ACLs (Access Control Lists) enabled by default, and they're essential to run Jobe. A quick web search suggests you can set them up, but you're on your own here.

Another option to consider is to run Jobe via Docker see here; this even works on Windows machines.

In reply to Richard Lobb

Re: Jobe Server on a Raspberry Pi

by Michael Backus -
I'm trying to setup jobe on a Raspberry Pi. I'm not going to be using it much, so setting up a droplet is a bit overkill. At any rate, I got the testsubmit.py program to run, but there are two errors. I'm guessing the first is actually something that needs to change in the testsucmit program (it appears to be using a deprecated comman), but I'm not sure about the 2nd. I don't plan to teach my students Java. Is this something I need to fix, or can it be ignored?

Thanks for your help and thanks for making CodeRunner available.

root@raspberrypi:/var/www/html/jobe# python3 testsubmit.py
Supported languages:
    c: 8.3.0
    cpp: 8.3.0
    java: 11.0.3
    nodejs: 10.15.2
    octave: 4.4.1
    pascal: 3.0.4
    php: 7.3.4
    python2: 2.7.16
    python3: 3.7.3
Valid Python3 OK
Python3 with stdin OK
Syntactically invalid Python3 OK
Python3 runtime error OK
Python3 file I/O OK
Testing use of interpreter args with Python3 OK
Testing use of runargs args with Python3 OK
***************** FAILED TEST ******************
{'run_id': None, 'outcome': 12, 'cmpinfo': '', 'stdout': 'Hello Python\n', 'stderr': 'test.py:2: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead\n  t = clock()\ntest.py:3: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead\n  while clock() < t + 10: pass  # Wait 10 seconds\n'}
Python3 program with customised timeout
Jobe result: Runtime error
Output:
Hello Python

Error output:
test.py:2: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
  t = clock()
test.py:3: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
  while clock() < t + 10: pass  # Wait 10 seconds

************************************************
Python3 program with support files OK
Valid Python3/pylint program OK
Invalid Python3/pylint program OK
UTF-8 output from Python3 (will fail unless Jobe set up for UTF-8) OK
Test good C hello world OK
Test compile error C hello world OK
Test use of compileargs with C OK
Test runtime error C hello world OK
Test timelimit on C OK
Test outputlimit on C OK
Memory limit exceeded in C (seg faults) OK
Infinite recursion (stack error) on C OK
C program controlled forking OK
A C program with ASCII non-UTF-8-compatible output OK
Valid Octave OK
octave with stdin OK
Syntactically invalid Octave (treated as runtime error) OK
Syntactically valid Nodejs hello world OK
Syntactically invalid (non-strict) Nodejs OK
Correct Php program  OK
Syntactically incorrect Php program  OK
Syntactically incorrect Php program  OK
Correct Java program  OK
Correct Java program without supplied sourcefilename  OK
Syntactically incorrect Java program  OK
Java program with a support class (.java) OK
***************** FAILED TEST ******************
{'run_id': None, 'outcome': 11, 'cmpinfo': 'Test.java:4: error: unmappable character for encoding ASCII\n        System.out.println("Un r??le d??l??t??re");\n                                ^\nTest.java:4: error: unmappable character for encoding ASCII\n        System.out.println("Un r??le d??l??t??re");\n                                 ^\nTest.java:4: error: unmappable character for encoding ASCII\n        System.out.println("Un r??le d??l??t??re");\n                                      ^\nTest.java:4: error: unmappable character for encoding ASCII\n        System.out.println("Un r??le d??l??t??re");\n                                       ^\nTest.java:4: error: unmappable character for encoding ASCII\n        System.out.println("Un r??le d??l??t??re");\n                                         ^\nTest.java:4: error: unmappable character for encoding ASCII\n        System.out.println("Un r??le d??l??t??re");\n                                          ^\nTest.java:4: error: unmappable character for encoding ASCII\n        System.out.println("Un r??le d??l??t??re");\n                                            ^\nTest.java:4: error: unmappable character for encoding ASCII\n        System.out.println("Un r??le d??l??t??re");\n                                             ^\n8 errors\n', 'stdout': '', 'stderr': ''}
Java program with Unicode output (will fail unless Jobe set up for UTF-8) 
Jobe result: Compile error
Compiler output:
Test.java:4: error: unmappable character for encoding ASCII
        System.out.println("Un r??le d??l??t??re");
                                ^
Test.java:4: error: unmappable character for encoding ASCII
        System.out.println("Un r??le d??l??t??re");
                                 ^
Test.java:4: error: unmappable character for encoding ASCII
        System.out.println("Un r??le d??l??t??re");
                                      ^
Test.java:4: error: unmappable character for encoding ASCII
        System.out.println("Un r??le d??l??t??re");
                                       ^
Test.java:4: error: unmappable character for encoding ASCII
        System.out.println("Un r??le d??l??t??re");
                                         ^
Test.java:4: error: unmappable character for encoding ASCII
        System.out.println("Un r??le d??l??t??re");
                                          ^
Test.java:4: error: unmappable character for encoding ASCII
        System.out.println("Un r??le d??l??t??re");
                                            ^
Test.java:4: error: unmappable character for encoding ASCII
        System.out.println("Un r??le d??l??t??re");
                                             ^
8 errors


************************************************
Test good C++ hello world OK
Test compile error C++ hello world OK
Good Hello world Pascal test OK
Fail Hello world Pascal test OK
39 tests, 37 passed, 2 failed, 0 exceptions
Checking parallel submissions
Doing child 0
Doing child 1
Doing child 2
Doing child 3
Doing child 4
Doing child 5
Doing child 6
Doing child 7
Doing child 8
Doing child 9
C program to check parallel submissions OK
C program to check parallel submissions OK
C program to check parallel submissions OK
C program to check parallel submissions OK
C program to check parallel submissions OK
C program to check parallel submissions OK
C program to check parallel submissions OK
C program to check parallel submissions OK
C program to check parallel submissions OK
C program to check parallel submissions OK
All done
Testing a submission with an excessive cputime parameter
OK
In reply to Michael Backus

Re: Jobe Server on a Raspberry Pi

by Richard Lobb -

Well done on getting it going. Did you have any trouble with ACLs?

Thanks for the heads up on the deprecation of time.clock; I haven't seen that deprecation warning before. I've changed testsubmit.py to use time.perf_counter instead and the change will appear on the next push.

You can safely ignore the java warnings if you're not planning on teaching Java. It seems like your Java is assuming ASCII file encoding by default, rather than UTF-8. This stackoverflow posting says there's a way of setting the assumed file encoding for the Java tools but if you don't need Java, don't bother.

In reply to Richard Lobb

Re: Jobe Server on a Raspberry Pi

by Michael Backus -
Thanks for getting back to me. I tried replacing the line that uses clock with time.perf myself, but it didn't work. I'm guessing it's not that simple. Once your fix is in the master branch, I'll test it out.

As for the Java fix, I went ahead and gave it a try. I copied the following line into the terminal:
export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8

I'm still getting the same error there as well, so again I assume I'm missing something. Is that a line in a file that I need to change? If so, where is it?

As for getting things running on a Pi, it was surprisingly easy. The one thing I did that wasn't in your documentation was run
apt-get install --fix-missing
after I installed the dependencies listed in your documentation. I then tried reinstalling those dependencies and several more items were installed. Once that was done, I tried installing the dependencies again just to make sure everything was installed, and sure enough it was! Might want to add that note to your documentation. Maybe some other small time nerds who are only using your software with a limited number of students will also benefit (especially now that you can get the Pi4 with 4 Gigs of ram).

In reply to Michael Backus

Re: Jobe Server on a Raspberry Pi

by Richard Lobb -

Good to know the install went so well on the Pi. I've added a note about the 'fix missing' command to the documentation.

I don't think it's worth pursing the Java problem if you're not intending to use Java yourself. Anyway, I think you'll find Java works OK from within CodeRunner unless you use Unicode characters within the source code. It's even possible that Unicode characters will work there, anyway.

If you do wish to use Unicode from within CodeRunner then you could try customising the question, choosing Advanced Customisation and setting the Sandbox parameters field to

{"compileargs":["-encoding UTF8"]}

No guarantees that will work, though.

In reply to Richard Lobb

Re: Jobe Server on a Raspberry Pi

by Michael Backus -
Mostly I wanted to tackle the failed Java test to help improve your documentation. If you think of something you'd like me to try, let me know. Otherwise, I'll take your advice and not worry about it.