Integrate Maple with Coderunner

Integrate Maple with Coderunner

by James Skevington -
Number of replies: 2

I have been working with Firat to try and integrate Maple with coderunner and we have ran into a block when the python code tries to run Maple. We were expecting this to work much like clips but have ran into the following message when the quiz question is checked.

Maple initialization error, maple: process limit must be at least 50

I'm trying to understand where this is falling down as the ulimit's that I have been able to check seem well above 50(php,apache,maple). I'm struggling to follow the logical path to work out where the problem is, unable to find a relevant log with an error.

The coderunner plugin in Moodle sends python code to the jobe server, this is picked up by jobe's php api entry point. At this point I'm unsure what exactly is trigging the maple command, so unable to verify the ulimit being imposed.

Any help would be great, thanks in advance :)

Firat's python code can be seen below:

import subprocess, os, shutil

student_answer = """sum(1.0/n, n= 1..10);

SEPARATOR = "#<ab@17943918#@>#"
prelude = ""# nothing here

testcode = """"""
extra = """"""
code_to_run = '\n'.join([prelude, extra, student_answer, testcode,postlude])

with open('commands', 'w') as maple_commands:
with open('commands') as cmd_input:
    text_input =
        output = subprocess.check_output(['/opt/maple2017/bin/maple'], input='quit',
                universal_newlines=True )

    except subprocess.CalledProcessError as e:
    except Exception as e:
        raise Exception("maple error: " + str(e))

In reply to James Skevington

Re: Integrate Maple with Coderunner

by Richard Lobb -

Jobe runs jobs using the runguard sandbox from the domjudge programming contest server. This sets limits ("ulimits") on the number of processes, memory usage and CPU time to protect against things like fork bombs, memory hogging and endless loops. The default value for the number of processes is 20 - see here. You can raise this value from within CodeRunner by setting the sandbox parameters field of the Advanced Customisation panel to a value like

{"numprocs": 80}

You will almost certainly need to raise the memory limit as well. There's a screenshot showing those settings in this forum discussion.

This is an interesting project. Would you mind posting a report to this forum when (if?) it's all going, please?


PS: I assume you're aware of the Stack plugin for Moodle as a possible alternative?

In reply to Richard Lobb

Re: Integrate Maple with Coderunner

by James Skevington -
Hi Richard
Perfect, that has sorted the problem.

My involvement with this project has been fairly minimal. However I advise talking with Firat (who you may of seen post on here), he has been running a program to get people using Code Runner at Loughborough in various disciplines. It's looking really promising at present.

Thanks again