mitodl / salt-ops

Repository for building, managing and deploying salt-based infrastructure
BSD 3-Clause "New" or "Revised" License
47 stars 7 forks source link

Ginkgo: python_lib.zip imported through git doesn't work #462

Closed pdpinch closed 6 years ago

pdpinch commented 6 years ago

For convenience, some courses store frequently used python code in a common library file (or files). Before the ficus upgrade, these files could be stored anywhere in the course repo although, by convention, they were stored at the root of the repo in a directory named /python_lib. This is no longer working.

See https://odl.zendesk.com/agent/tickets/10494

The workaround is to import python_lib.zip through the Studio UI, but this requires that the EdTech team manually update python_lib.zip on the LMS server.

pdpinch commented 6 years ago

I'm looking for a sample course for testing this.

pdpinch commented 6 years ago

Sample course and python library:

course: https://staging.mitx.mit.edu/courses/MITx/jolyon.000/2017_Summer/info repo: https://github.mit.edu/chudzick/mitx-graders

pdpinch commented 6 years ago

Here's a course on the QA stack that demonstrates the problem:

I used the sysadmin panel to import via git from the repo at git@github.mit.edu:mitx/content-devops-0001.git and the branch pdpinch/add-mitx-grading-library

The repo includes a python_lib.zip in the static directory.

However, when I view the courseware that imports from the python library I get an import error

Traceback (most recent call last):
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1182, in _xmodule
    for_parent=self.get_parent() if self.has_cached_parent else None
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/xblock/runtime.py", line 633, in construct_xblock_from_class
    *args, **kwargs
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/capa_base.py", line 249, in __init__
    self.lcp = self.new_lcp(self.get_state_for_lcp())
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/capa_base.py", line 345, in new_lcp
    capa_module=self,  # njp
  File "/edx/app/edxapp/edx-platform/common/lib/capa/capa/capa_problem.py", line 191, in __init__
    self.context = self._extract_context(self.tree)
  File "/edx/app/edxapp/edx-platform/common/lib/capa/capa/capa_problem.py", line 746, in _extract_context
    raise responsetypes.LoncapaProblemError(msg)
Exception: cannot create LoncapaProblem block-v1:DevOps+0.001_2+2018_Spring+type@problem+block@problem_bd3b45d8bb48: Error while executing script code: Couldn't execute jailed code: stdout: '', stderr: 'Traceback (most recent call last):\n  File "jailed_code", line 15, in <module>\n    exec code in g_dict\n  File "<string>", line 64, in <module>\nImportError: No module named mitxgraders\n' with status code: 1
pdpinch commented 6 years ago

The fix in https://github.com/mitodl/edx-platform/pull/50 works for me at https://mitx-qa-next.mitx.mit.edu/courses/course-v1:DevOps+0.001_2+2018_Spring/courseware/examples/stringgrader/2

@mitodl/devops please close this when the fix is merged and part of the AMI.

pdpinch commented 6 years ago

@mitodl/devops can we close this?