Skip to main content

Grading Environment Variables

Reference guide for the environment variables available in Vocareum labs during the grading process.

Written by Mary Gordanier
Updated this week

For Teachers & Admins

When a student submits an assignment that contains a grade.sh script, the following environment variables are available inside the grading environment.

Tested against Vocareum Notebook, VS Code, and JupyterLab. ✓ = present, ✗ = not present.


Variable reference

Grade and report outputs

Variable

Description

VNB

VS Code

JupyterLab

$vocareumGradeFile

Path to the grade output file. Write one Criterion Name,Score line per rubric criterion. Vocareum reads this file after grade.sh exits and records the scores.

$vocareumReportFile

Path to the report output file. Write free-form text or HTML here; Vocareum displays it to the student as feedback. To suppress raw script stdout/stderr from appearing in the report, write VOC_NO_REPORT_OUTPUT as the first line.

Working directory

Variable

Description

VNB

VS Code

JupyterLab

$VOC_HOME_DIR

Path to the student's working directory (/voc/work). Student-submitted files are copied here before grade.sh runs. Use this variable rather than a hardcoded path so your script works correctly across lab types.

$VOC_WORKAREA

Host-side mount path for the student's working area (e.g., /mnt/worktest/grader/.../work). This is the underlying path on the grading server; use $VOC_HOME_DIR for reading student files instead.

Assignment and course identifiers

Variable

Description

VNB

VS Code

JupyterLab

$VOC_COURSEID

Vocareum course ID.

$VOC_ASSIGNMENTID

Vocareum assignment ID.

$VOC_PARTID

Vocareum part ID.

$VOC_PARTVERSION

The version of the part the learner selected, for assignments with multiple versions.

$VOC_SUBMISSION_COUNT

Number of times this student has submitted this part.

User identifiers

Variable

Description

VNB

VS Code

JupyterLab

$VOC_USERID

Vocareum user ID of the submitting student.

$VOC_USER_EMAIL

Email address of the submitting student.

$VOC_EMAIL_ID

Internal Vocareum email identifier.

Jupyter environment

These variables relate to the Jupyter runtime configuration and are not typically needed in grading scripts.

Variable

Description

VNB

VS Code

JupyterLab

$VOC_JUPYTER_IDE_TYPE

The Jupyter IDE type (e.g., lab).

$VOC_JUPYTER_PREF_DIR

Jupyter's preferred directory (/home/labsuser). Note: this is not the student working directory — student files are at $VOC_HOME_DIR.

$VOC_JUPYTER_ROOT_DIR

Root directory for the Jupyter file browser (/).

$VOC_JUPYTER_USERNAME

Username for the Jupyter session (labsuser).

$VOC_KERNEL_APP

Jupyter kernel application (e.g., jupyter kernelgateway).

$VOC_KERNEL_BASE_URL

Base URL for the Jupyter kernel.

$VOC_KERNEL_PORT

Port the Jupyter kernel listens on.

Other

Variable

Description

VNB

VS Code

JupyterLab

$VOC_CURRENT_GRADE

The student's current recorded grade for this part before this submission is processed.

$VOC_CUSTOM_DATA_FILE

Filename for passing custom data between Vocareum components.

$VOC_IPC_DATA_FILE

Filename used for inter-process communication within the grading pipeline.

$VOC_RESOURCE_TAGS

Base64-encoded JSON blob containing course, part, and user identifiers. Not typically needed in grading scripts.


GenAI variables

When GenAI is enabled for your course, additional environment variables are injected for AI model access. See the Environment Variables section of GenAI in Vocareum Labs for the full list and setup instructions.


Accessing variables in scripts

In bash (grade.sh):

echo "Working dir: $VOC_HOME_DIR" echo "Submission count: $VOC_SUBMISSION_COUNT"

In Python (grade.py):

import os  work_dir       = os.environ.get("VOC_HOME_DIR", "/voc/work") submission_num = os.environ.get("VOC_SUBMISSION_COUNT", "1")
Did this answer your question?