Hello community, I have a question.
Have you had a problem loading the codejail settings in async tasks?
For some tasks it is required to run code in edxapp-sandbox through codejail and the settings are read with the middleware, but in edxapp async the middlewares are not run and it uses the default settings and in my case it is very little, this happens because example in the rescore of a loncapa problem.
I got this PR with an idea: wip: Load codejail configuration on-demand instead of on-initializtaion by kdmccormick · Pull Request #98 · openedx/codejail · GitHub
However I am not quite sure how to continue that work or if there is another way or a better approach to solve this problem.
How to replicate the problem:
- Have a course with an loncapa problem (such as advance problem > python-evaluated input)
- Have celery workers running in the devstack
Taken from the following pr: fix: xblock-poll's export to CSV feature is not working [TNL-8370] [MNG-2273] by bradenmacdonald · Pull Request #28019 · openedx/edx-platform · GitHub
It took me a while to figure out how to run celery workers on the docker devstack - am I missing some documentation?
First, use
make lms-shell
then edit/edx/etc/lms.yml
. Make sureCELERY_QUEUES
is as follows:CELERY_QUEUES: - edx.lms.core.default - edx.lms.core.high - edx.lms.core.high_mem
(for some reason, on my devstack, these all had wrong values like
edx.lms.core.defaultedx.lms.core.
, whileCELERY_DEFAULT_QUEUE
had a correct value, resulting in the worker never seeing the tasks)Second, add this to
lms/envs/private.py
:CELERY_ALWAYS_EAGER = False BROKER_URL = 'redis://:password@edx.devstack.redis:6379/'
Third, start Redis with
make redis-up
Fourth, restart the LMS.
Fifth: from
make lms-shell
, start a celery worker withDJANGO_SETTINGS_MODULE=lms.envs.devstack_with_worker celery worker --app=lms.celery:APP
- Put a print in codejail plugin
https://github.com/openedx/codejail/blob/master/codejail/jail_code.py#L293
print("#"*30)
print(effective_limits)
- Do a rescore in Instructor > Student Admin and see that changes in devstack.py or common.py don’t change the codejail settings