openedx / xqueue-watcher

GNU Affero General Public License v3.0
17 stars 39 forks source link

Problem with grader requirements #11

Open carsongee opened 10 years ago

carsongee commented 10 years ago

I have a grader that needs additional libraries. They are installed no problem, but when the xqueuewatcher imp loads the grader it doesn't have that library: https://github.com/edx/xqueue-watcher/blob/master/xqueue_watcher/jailedgrader.py#L103

The relevant parts from the grader:

import numpy as np
from numpy import array, matrix
import gradelib
reload(gradelib)
from gradelib import Grader, InvokeStudentFunctionTest, must_define_function, rand, generateRandom2DData

fn = "perceptron"

grader = Grader()
grader.add_input_check(must_define_function(fn))

Should I just make a task in the ansible play to install all the individual coder requirements into the root processes' venv, or is there a better way?

e0d commented 10 years ago

Yeah I'm familiar with this problem and I think we need to fix the watcher, I discussed with Ned and DCS a while ago, let me revive that conversation.

davestgermain commented 10 years ago

What is the actual exception? I noticed that generateRandom2DData doesn't exist in gradelib.py

carsongee commented 10 years ago

I think that will likely turn into another issue after we get past this one that we may just be able to fix in the courseware. The particular class has extended gradelib.py in it's own repo and will stack dump with:

ERROR:xqueue_watcher.client:cannot import name generateRandom2DData
Traceback (most recent call last):
  File "xqueue_watcher/client.py", line 134, in process_one
    success = self._handle_submission(content)
  File "xqueue_watcher/client.py", line 117, in _handle_submission
    result = handler(content)
  File "xqueue_watcher/grader.py", line 107, in __call__
    return self.process_item(content)
  File "xqueue_watcher/grader.py", line 136, in process_item
    results = self.grade(grader_path, grader_config, student_response)
  File "xqueue_watcher/jailedgrader.py", line 103, in grade
    grader_module = imp.load_source("grader_module", grader_path)
  File "/edx/app/xqwatcher/data/MITx-6.s064x/graders/project_1/perceptron/grade_perceptron.py", line 4, in <module>
    from gradelib import Grader, InvokeStudentFunctionTest, must_define_function, rand, generateRandom2DData
ImportError: cannot import name generateRandom2DData

Is there anyway to allow it to have it's own version with xqueue-watcher or is the only way just to move those added functions into another module? Is there a way to have common modules for a course, or does it all have to be inline? I haven't looked too closely yet if it has changed any internal functions in greadelib over what xqwatcher provides to know if an override would be mandatory.

The stack trace for the numpy issue though, which is more specifically what I'd like to address first is:

ERROR:xqueue_watcher.client:No module named numpy
Traceback (most recent call last):
  File "xqueue_watcher/client.py", line 134, in process_one
    success = self._handle_submission(content)
  File "xqueue_watcher/client.py", line 117, in _handle_submission
    result = handler(content)
  File "xqueue_watcher/grader.py", line 107, in __call__
    return self.process_item(content)
  File "xqueue_watcher/grader.py", line 136, in process_item
    results = self.grade(grader_path, grader_config, student_response)
  File "xqueue_watcher/jailedgrader.py", line 103, in grade
    grader_module = imp.load_source("grader_module", grader_path)
  File "/edx/app/xqwatcher/data/MITx-6.s064x/graders/project_1/perceptron/grade_perceptron.py", line 1, in <module>
    import numpy as np
ImportError: No module named numpy
alexandervaldez commented 9 years ago

hi i am trying to connect xqwatcher to xqueue , how can i create a queue for xqtwatcher? inside the xqueue.env.json?

nickjm commented 6 years ago

Hi I would like to revisit this issue. I am helping launch a course that also has common functionality that should be shared across graders as @carsongee describes. My current solution is to copy in a module to the clean directory where the submission code runs, but this is only possible with a custom grade.py file which I'm unable to specify -- see issue #33