Saved searches

Use saved searches to filter your results more quickly

Cancel Create saved search Sign up Reseting focus

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

License

Notifications You must be signed in to change notification settings

coursera/coursera_autograder

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Go to file

Folders and files

Last commit message Last commit date

Latest commit

History

View all files

Repository files navigation

coursera_autograder

This command-line tool is a software development toolkit to help instructional teams author asynchronous graders for Coursera (typically programming assignments). Coursera's asynchronous grading environment is based upon docker. While use of this tool is by no means required to develop the docker container images, we believe it is helpful in the endeavour. See below for brief descriptions of this tool's capabilities.

Installation

You can install coursera_autograder using pip! Simply run:
python3 -m pip install coursera-autograder
Upgrade the coursera_autograder package by running:
pip install coursera-autograder --upgrade

If you've previously installed coursera_autograder from source, you can uninstall it by navigating to the directory where it is installed and running:

python setup.py develop --uninstall
Alternatively, you may use the following commands to install from source:
git clone https://github.com/coursera/coursera_autograder.git cd coursera_autograder virtualenv -p python3 venv (Optional) source venv/bin/activate (Optional) python setup.py develop pip install -r test_requirements.txt pip install -e .

If you would like to separate your build environments, we recommend installing coursera_autograder within a virtual environment. pip is a python package manager. If you do not have pip installed on your machine, please follow the installation instructions for your platform found at: https://pip.pypa.io/en/latest/installing.html#install-or-upgrade-pip The tool includes its own usage information and documentation. Simply run:

coursera_autograder -h
coursera_autograder --help

for a complete list of features, flags, and documentation. Note: the tool requires docker to already be installed on your machine. Please see the docker installation instructions for further information.

Subcommands

grade local

In contrast to this local tester, Coursera's production system will also set these environment variables for internal purposes. In local testing, it is possible to specify these as well with the environment variable JSON, although it's completely up to the grading Docker you create to use them or not. In typical usage, you would not set or read these variables.

upload

Allows an instructional team to upload their containers to Coursera without using a web browser. It is designed to even work in an unattended fashion (i.e. from a jenkins job). In order to make the upload command work from a Jenkins automated build machine, simply copy the ~/.coursera directory from a working machine, and install it in the jenkins home folder. Beware that the oauth2_cache file within that directory contains a refresh token for the user who authorized themselves. This refresh token should be treated as if it were a password and not shared or otherwise disclosed!

To find the course/branch id, item id, and part id:

    Go to the web authoring interface for your programming assignment. There, the URL will be of the form:

/:courseSlug/author/outline/programming/:itemId/

The part id can be found in the authoring user interface for each part.

    To convert the courseSlug into a courseId , you can take advantage of our Course API putting in the appropriate courseSlug . For example, given a course slug of developer-iot , you can query the course id by making the request:

https://api.coursera.org/api/onDemandCourses.v1?q=slug&slug=developer-iot

The response will be a JSON object containing an id field with the value:

iRl53_BWEeW4_wr--Yv6Aw
  1. If the grader that you're looking to upload/update is not in the Original Version of the course, you'll most likely need to get a branch id. To this, you'll need the courseId and the versionName . Make the following request:
https://api.coursera.org/api/authoringBranchProperties.v1?q=course&courseId=&fields=properties

Search for your version name (it'll be in the properties.name field), and find the associated id (it should look something like: authoringBranch~xxxxxxxxxxxxxxxxxxxxxx . (Please note that this form of branch id is only applicable for non-original versions of the course. For the original version, the id will be a twenty-two character long string with no prefix).

The uploaded grader can be linked to multiple (itemId, partId) pairs without making duplicate uploads by using the --additional_item_and_part flag.

This command can also be used to customize the resources that will be allocated to your grader when it grades learner submissions. The CPU, memory limit and timeout are all customizable.