Skip to content

Conversation

pkulkark
Copy link
Member

@pkulkark pkulkark commented Aug 11, 2025

Description

This PR adds a pluggable code execution backend for the Coding XBlock, allowing deployments to use either the default Judge0 service or a configurable third‑party service. The execution backend is setup via Django settings (AI_EVAL_CODE_EXECUTION_BACKEND). It also allows to optionally override the judge0 base URL via judge0_conf ig.base_url which can be used in case of self-hosted judge0 service. If no settings are provided, existing Judge0 behaviour continues unchanged.

Supporting information

OpenCraft's Internal Jira task: BB-9936

Testing instructions

  1. Check out this branch and without changing any settings, verify that the default behaviour of using judge0 rapidapi works properly.
  2. For a custom service, set the following django settings through tutor plugin:
AI_EVAL_CODE_EXECUTION_BACKEND = { 
    'backend': 'custom',
    'custom_config': { 
        'submit_endpoint': 'https://.../submit',
        'results_endpoint': 'https://.../results/{submission_id}',
        'languages_endpoint': 'https://.../languages',
        'api_key': '<token>',
        'auth_header_name': 'Authorization',
        'auth_scheme': 'Bearer',
        'timeout': 30
    }
}
  1. Verify that the coding xblock works as expected.

Other information

Note: This change relies on the fact that the external service has an asynchronous model (similar to judge0) and separate submit_endpoint which returns a submission ID and results_endpoint which is polled with {submission_id}) for results. An additional languages_endpoint is used to validate supported languages.

@pkulkark pkulkark force-pushed the pooja/bb-9936-changes branch 8 times, most recently from 25301cc to 9cc86f6 Compare August 11, 2025 18:20
@pkulkark pkulkark marked this pull request as ready for review August 11, 2025 18:40
@viadanna
Copy link
Member

Approved 👍

  • I tested this on my devstack.
  • I read through the code.
  • I checked for accessibility issues.
  • Includes documentation.

@pkulkark pkulkark force-pushed the pooja/bb-9936-changes branch from b5bd1c3 to 98ea5b1 Compare September 19, 2025 19:29
@pkulkark pkulkark force-pushed the pooja/bb-9936-changes branch from d2800c3 to cd9f555 Compare October 2, 2025 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants