Errors in creating a "Custom Python-evaluated Input" and a "Custom JavaScript display and grading" problems

Hi,

I use Tutor Redwood. I try to create a custom python-evaluated input problem with predefined HTML. And I got error at the first time.

The same problem occurs with
“Custom JavaScript display and grading” problem too.

Do I have to install (codejail service)?

If not, what kind of plugin that I have to install? Please help.

Thank you very much.

@N_V I won’t be able to help you solve this, but I’d like to help you make your question better. Could you share the problem you’re trying to create? It may be difficult to understand the error shown without seeing the input that led to the error.

@N_V, you are correct, to be able to use those types of problems you need to install the tutor-contrib-codejail plugin.

A simple (assuming you are using tutor local):

pip install git+https://github.com/edunext/tutor-contrib-codejail@v18.0.0
tutor plugins enable codejail
tutor config save
tutor local do init --limit codejail
tutor local start -d

should do the trick.

Keep in mind that the init command (tutor local do init --limit codejail) loads an apparmor profile in your host. If you ever reboot the host you must run the command again, otherwise you would get an error when starting the containers.

Thanks for replaying. Here are my steps.

On my local machine,

  1. Create a Unit, I click the problem button > advanced problem > choose either “Custom Python display and grading” or “Custom JavaScript display and grading”.
  2. Predefined HTML is there, and Save.

Thanks a lot for your guidance. I follow the steps and found error about accessing appamor profile as the following:

C:\>tutor local do init --limit codejail
Initialising all services...
Running init task in codejail-apparmor
docker compose -f 'C:\host\env\local\docker-compose.yml' -f 'C:\host\env\local\docker-compose.prod.yml' --project-name tutor_local -f 'C:\host\env\local\docker-compose.jobs.yml' run --rm codejail-apparmor-job sh -e -c 'if [  "$SKIP_INIT" == "True" ]; then
    echo "Skipped AppArmor initialization"
else
    /usr/bin/loader -logtostderr -v=2 /profiles
fi'
F0927 05:26:17.875311       1 loader.go:69] Unable to access apparmor profiles: failed to open /sys/kernel/security/apparmor/profiles: open /sys/kernel/security/apparmor/profiles: no such file or directory
Error: Command failed with status 1: docker compose -f C:\host\env\local\docker-compose.yml -f C:\host\env\local\docker-compose.prod.yml --project-name tutor_local -f C:\host\env\local\docker-compose.jobs.yml run --rm codejail-apparmor-job sh -e -c if [  "$SKIP_INIT" == "True" ]; then
    echo "Skipped AppArmor initialization"
else
    /usr/bin/loader -logtostderr -v=2 /profiles
fi

Do I need to additional set up? I do not have much experience. I might miss a thing.

Thank you again.

Judging by the shell prompt (C:\>) it seems like you are running on windows. You must have AppArmor installed on the host. We usually deploy to Ubuntu which comes with AppArmor preinstalled.

I cannot really guarantee support for other OSes, but you can try to skip the loading by setting the CODEJAIL_ENFORCE_APPARMOR to false in your config.yaml file.