Régis Behmo 18a6d5bc39
fix: add missing pkg-config package (#26)
Build fails in nightly with the following error:

	#28 5.503   × Getting requirements to build wheel did not run
	    successfully.
	#28 5.503   │ exit code: 1
	#28 5.503   ╰─> [24 lines of output]
	#28 5.503       /bin/sh: 1: pkg-config: not found
	#28 5.503       /bin/sh: 1: pkg-config: not found
	#28 5.503       Trying pkg-config --exists mysqlclient
	#28 5.503       Command 'pkg-config --exists mysqlclient' returned
	    non-zero exit status 127.
	#28 5.503       Trying pkg-config --exists mariadb
	#28 5.503       Command 'pkg-config --exists mariadb' returned non-zero
	    exit status 127.
	#28 5.503       Traceback (most recent call last):
	#28 5.503         File
	    "/openedx/venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py",
	line 353, in <module>
	#28 5.503           main()
	#28 5.503         File
	    "/openedx/venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py",
	line 335, in main
	#28 5.503           json_out['return_val'] =
	    hook(**hook_input['kwargs'])
	#28 5.503         File
	    "/openedx/venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py",
	line 118, in get_requires_for_build_wheel
	#28 5.503           return hook(config_settings)
	#28 5.503         File
	    "/tmp/pip-build-env-58chejnv/overlay/lib/python3.8/site-packages/setuptools/build_meta.py",
	line 355, in get_requires_for_build_wheel
	#28 5.503           return self._get_build_requires(config_settings,
	    requirements=['wheel'])
	#28 5.503         File
	    "/tmp/pip-build-env-58chejnv/overlay/lib/python3.8/site-packages/setuptools/build_meta.py",
	line 325, in _get_build_requires
	#28 5.503           self.run_setup()
	#28 5.503         File
	    "/tmp/pip-build-env-58chejnv/overlay/lib/python3.8/site-packages/setuptools/build_meta.py",
	line 341, in run_setup
	#28 5.503           exec(code, locals())
	#28 5.503         File "<string>", line 154, in <module>
	#28 5.503         File "<string>", line 48, in get_config_posix
	#28 5.503         File "<string>", line 27, in find_package_name
	#28 5.503       Exception: Can not find valid pkg-config name.
	#28 5.503       Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env
	    vars manuallY
2023-11-21 06:39:16 -05:00
🌅
2019-08-21 12:22:46 +02:00
🌅
2019-08-21 12:22:46 +02:00
2023-06-15 01:04:59 +02:00
2020-05-05 16:52:52 +02:00
🌅
2019-08-21 12:22:46 +02:00
2023-05-17 10:24:21 +02:00
2023-08-14 16:24:05 +02:00

Xqueue external grading system plugin for `Tutor <https://docs.tutor.overhang.io>`_
===================================================================================

This is a plugin for `Tutor <https://docs.tutor.overhang.io>`_ that provides the Xqueue external grading system for Open edX platforms. If you don't know what it is, you probably don't need it.

Installation
------------

The plugin is currently bundled with the `binary releases of Tutor <https://github.com/overhangio/tutor/releases>`__. If you have installed Tutor from source, you will have to install this plugin from source, too::

    tutor plugins install xqueue

Then, to enable this plugin, run::

    tutor plugins enable xqueue

You should then run the initialisation scripts. The easiest way to do this is to run ``tutor local launch``.

Usage
-----

In the Open edX studio, edit a course and add a new "Advanced blank problem" ("Problem" → "Advanced" →  "Blank Advanced Problem"). Then, click "Edit" and copy-paste the following in the editor::


    <problem>
      <coderesponse queuename="openedx">
        <label>Write a program that prints "hello world".</label>
        <textbox rows="10" cols="80" mode="python" tabsize="4"/>
        <codeparam>
          <initial_display>
            # students write your program here
            print("")
          </initial_display>
          <answer_display>
            print("hello world")
          </answer_display>
          <grader_payload>
            {"name": "hello world"}
          </grader_payload>
        </codeparam>
      </coderesponse>
    </problem>

For a problem that includes a file submission, write instead::

  <problem>
    <coderesponse queuename="openedx">
      <filesubmission/>
      <codeparam>
        <grader_payload>
          {"name": "file submission"}
        </grader_payload>
      </codeparam>
    </coderesponse>
  </problem>

Note that in all cases, the queue name must be "openedx".

Save and publish the created unit. Then, access the unit from the LMS and attempt to answer the problem. The answer is sent to the Xqueue service. If you know how to use the Xqueue API, you can access it at http(s)://xqueue.LMS_HOST (in production) or http://xqueue.local.overhang.io (in development). However, the Xqueue API is a bit awkward to use. Tutor provides a simple command-line interface to interact with the Xqueue service.

Count the number of submissions that need to be graded::

    $ tutor xqueue submissions count
    {
      "content": 0,
      "return_code": 0
    }

.. note::
    By default, ``tutor xqueue submissions`` will hit the Xqueue API running at http(s)://xqueue.LMS_HOST. To hit a different server, you should pass the ``--url=http://xqueue.yourcustomhost.com`` option to the CLI. Alternatively, and to avoid passing this option every time, you can define the following environment variable::

        export TUTOR_XQUEUE_URL=http://xqueue.yourcustomhost.com

Show the first submission that should be graded::

    $ tutor xqueue submissions show
    {
      "id": 1,
      "key": "692c2896cdfc8bdc2d073bc3b3daf928",
      "body": {
        "student_info": "{\"random_seed\": 1, \"anonymous_student_id\": \"af46c9d6c05627aee45257d155ec0b79\", \"submission_time\": \"20200504101653\"}",
        "grader_payload": "\n        {\"output\": \"hello world\", \"max_length\": 2}\n      ",
        "student_response": "        # students write your program here\r\n        print \"42\"\r\n      "
      },
      "files": {},
      "return_code": 0
    }

Grade the submission (in this case, mark it as being correct)::

    $ tutor xqueue submissions grade 1 692c2896cdfc8bdc2d073bc3b3daf928 0.9 true "Good job!"
    {
      "content": "",
      "return_code": 0
    }

The submission should then appear as correct with the message that you provided on the command line:

.. image:: https://github.com/overhangio/tutor-xqueue/raw/master/screenshots/correctanswer.png
  :alt: Correct answer
  :align: center

Configuration
-------------

- ``XQUEUE_AUTH_PASSWORD`` (default: ``"{{ 8|random_string }}"``)
- ``XQUEUE_AUTH_USERNAME`` (default: ``"lms"``)
- ``XQUEUE_DOCKER_IMAGE`` (default: ``"{{ DOCKER_REGISTRY }}overhangio/openedx-xqueue:{{ TUTOR_VERSION }}"``)
- ``XQUEUE_HOST`` (default: ``"xqueue.{{ LMS_HOST }}"``)
- ``XQUEUE_MYSQL_PASSWORD`` (default: ``"{{ 8|random_string }}"``)
- ``XQUEUE_MYSQL_DATABASE`` (default: ``"xqueue"``)
- ``XQUEUE_MYSQL_USERNAME`` (default: ``"xqueue"``)
- ``XQUEUE_SECRET_KEY`` (default: ``"{{ 24|random_string }}"``)
- ``XQUEUE_REPOSITORY`` (default: ``"https://github.com/openedx/xqueue"``)
- ``XQUEUE_REPOSITORY_VERSION`` (default: ``"{{ OPENEDX_COMMON_VERSION }}"``)

These values can be modified with ``tutor config save --set PARAM_NAME=VALUE`` commands.

Debugging
---------

To debug the xqueue service, you are encouraged to mount the xqueue repo from the host in the development container:

    tutor dev start --mount /path/to/xqueue

Feel free to add breakpoints (``breakpoint()``) anywhere in your source code to debug your application.

License
-------

This work is licensed under the terms of the `GNU Affero General Public License (AGPL) <https://github.com/overhangio/tutor-xqueue/blob/master/LICENSE.txt>`_.

Troubleshooting
---------------

This Tutor plugin is maintained by Jhony Avella from `eduNEXT <https://www.edunext.co/>`__. Community support is available from the official `Open edX forum <https://discuss.openedx.org>`__. Do you need help with this plugin? See the `troubleshooting <https://docs.tutor.overhang.io/troubleshooting.html>`__ section from the Tutor documentation.
Description
Xqueue plugin for Tutor
Readme 254 KiB
Languages
Python 77%
Dockerfile 12.2%
Makefile 10.8%