Conversation
3bdc732 to
e4c187d
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #18 +/- ##
==========================================
+ Coverage 79.69% 86.98% +7.29%
==========================================
Files 30 7 -23
Lines 778 269 -509
Branches 50 23 -27
==========================================
- Hits 620 234 -386
+ Misses 136 31 -105
+ Partials 22 4 -18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| log = logging.getLogger("sql_grader") | ||
|
|
||
|
|
||
| def _send_to_codejailservice(code, globals_dict, slug=None): |
There was a problem hiding this comment.
Added _send_to_codejailservice() which sends code to the codejail-service REST API (/api/v0/code-exec), mirroring the protocol used by the problem XBlock in xblocks_contrib.problem.capa.safe_exec.remote_exec
Modified attempt_safe() to route based on ENABLE_CODEJAIL_REST_SERVICE:
- True → REST API (Tutor / production)
- False → local safe_exec (native installs, unchanged behaviour)
No python_path is sent to the REST API because sql_grader is pip-installed in the sandbox venv at image build time.
This function _send_to_codejailservice was generated with the help of Claude code,
This PR moved SQL grader XBlock from https://github.com/openedx/xblock-sql-grader
Fix: codejail-service REST API support
The original code called
codejail.safe_exec()directly, which crashes on Tutor deployments withFileNotFoundError: 'TMPDIR=tmp'.Tutor setsENABLE_CODEJAIL_REST_SERVICE=Trueand disables the local sandbox, routing all execution through the codejail-service container instead. See openedx/openedx-platform#36639Testing
Tested end-to-end on Tutor local with
tutor-contrib-codejail(v2 mode, openedx/codejail-service, Python 3.12). xblocks-extra was pip-installed in the sandbox venv viaCODEJAIL_EXTRA_PIP_REQUIREMENTS.Confirmed via codejail-service logs that requests reach the container:
The original repository is being deprecated here: openedx/xblock-sql-grader#255