Skip to content

Problem loading the codejail settings in async tasks #124

@MaferMazu

Description

@MaferMazu

Description

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 for example in the rescore of a loncapa problem.

I got this PR with an idea to solve the problem: #98

📌 But 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

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 sure CELERY_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. , while CELERY_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 with

DJANGO_SETTINGS_MODULE=lms.envs.devstack_with_worker celery worker --app=lms.celery:APP

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

Other info

Discuss: https://discuss.openedx.org/t/problem-loading-the-codejail-settings-in-async-tasks/6545

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions