Peteramati problem sets are configured primarily through JSON files. This document describes the JSON format.
The location of psets.json is set in conf/options.php:
$Opt["psetsConfig"] = PATHNAME;
PATHNAME is relative to the Peteramati directory.
A psets.json file can be merged from several JSON components:
$Opt["psetsConfig"] = [PATHNAME1, PATHNAME2, ...];
Peteramati will first read PATHNAME1, then PATHNAME2, and so forth, and merge the resulting JSON objects. In case of key conflicts, later values win. For example, given these files:
psets1.json: { "a": "pset1", "b": {"c": "pset1"} }
psets2.json: { "a": "pset2", "b": {"d": "pset2"} }
a psetsConfig option of ["psets1.json", "psets2.json"] would produce this
result:
{ "a": "pset2", "b": {"c": "pset1", "d": "pset2"} }
You may also use shell wildcards in the PATHNAMEs (*, ?, [...]).
Peteramati will read and merge any matching files.
If Peteramati cannot load a required psets.json file—either because the file
doesn't exist or is unreadable, or because of a JSON parsing error—it will
refuse to initialize.
A psets.json configuration is a JSON object. Keys that do not start with an
underscore define problem sets; keys that start with an underscore hold shared
configuration. Here's a small example:
{
"1": {
"psetid": 1,
"title": "problem set 1",
"partner": true,
"grades": {
"tests": {"max": 70},
"style": {"max": 10, "is_extra": true}
},
"visible": true
},
"2": {
"psetid": 2,
"title": "problem set 2 (not ready yet)",
"disabled": true
},
"_defaults": {
"grade_cdf_cutoff": 0.25,
"handout_repo_url": "git://code.seas.harvard.edu/cs61/cs61-psets.git"
}
}This defines two problem sets, "1" and "2". The underscore keys define shared configuration:
-
_defaults: object merged into every problem set (recursively, with the problem set’s own settings winning). -
_defaults_GROUP: object merged into every problem set whosecategoryisGROUP(applied before_defaults). -
_formulas: named formulas usable across problem sets (see “Formulas”). -
_grade_types: definitions of custom grade-entry types. -
_queues: run-queue definitions (see “Code execution”).
Some settings are identified as “dates”. Dates are specified either as integers,
which are Unix timestamps (seconds since the epoch), or strings (like "2014-10-07
00:00 EDT"), which are parsed. Some are “intervals”: a number of seconds, or a
string like 10m, 20s, 1.5h, or 2d.
A problem set defines everything about an assignment: its name and title, its deadlines, its grade entries, and its run entries.
Problem sets have keys that don't start with underscore, and must contain a
psetid entry. The configuration for a problem set is obtained by merging it
with _defaults_GROUP (if it has a category) and _defaults.
Each problem set has several identifiers. The psetid is used internally; the
others are shown to users in different contexts.
-
psetid: positive integer REQUIREDUnique identifier for the problem set. This identifier is stored in the database, so you should never change it once you've released a problem set (or student work and grades will effectively disappear).
-
problem set key: string
This is the JSON key used to define the problem set. It cannot start with an underscore. It may be a numeric string, but if so, it must equal
psetid. -
urlkey: stringThis string is the preferred way to identify the problem set in URIs. It defaults to the problem set key, but may differ; for example, if the problem set key is
pset1, you might prefer the shorter1for URIs, sincepeteramati/pset/pset1looks redundant.
-
title: stringHuman-friendly problem set name. This is the name displayed in the interface. Defaults to the problem set's JSON key.
-
category: string (aliasgroup)Groups related problem sets (for instance, for display and for the
_defaults_GROUPmechanism). Problem sets in the same category are considered successive versions of one another for “predecessor” purposes. -
weight: numberRelative weight of this problem set, e.g. when computing aggregate grades.
-
order: number (aliasposition)Determines display order among problem sets. Lower values sort first.
-
partner: booleanSet to true if this assignment may be completed in pairs.
-
visible: boolean or dateSet to true to make the problem set visible to students. If false or absent, the problem set is hidden on the student UI. If a date, then the problem set will become visible at that time.
-
disabled: booleanSet to true to hide the problem set from students and TFs. A disabled problem set is not present in the UI at all.
-
removed: boolean (aliasadmin_disabled)Like
disabled, but also marks the problem set as removed. -
frozen: boolean or dateSet to true to prevent students from changing problem set data (repository, preferred commit).
-
anonymous: booleanSet to true to hide student identities from graders.
-
hide_comments: booleanSet to true to hide line comments for this problem set.
-
gitless: booleanSet to true to mark the problem set as “gitless”. Use this for paper assignments, tests, etc.
-
gitless_grades: booleanSet to true to store the problem set’s grades independently of the student’s git history. Normally, peteramati stores a different grade per commit in the student’s history. (This facilitates regrades and can keep some grading history.) With
gitless_grades, grades are stored once per student. Implied bygitless. -
partner_repo: stringIf
"same"(the default), partners should have the same repository. If"different", partners should have different repositories. -
main_branch: stringThe repository’s main branch. Defaults to
master(ormainifhandout_branchismain). -
no_branch: booleanSet to true to disallow per-student branch selection.
-
handout_repo_url: stringGit URL for handout code. Required unless
gitless. -
handout_branch: stringBranch to use for handout code. Defaults to
main_branch. -
handout_hash: stringCommit hash to use for handout code and diffs. If not set, diffs are shown relative to a derived handout hash (the latest handout hash in the current commit’s history).
-
handout_warn_hash: stringWarn user if their handout code is before this hash. If not set,
handout_hashis used; if that’s not set, the latest handout commit is used. -
handout_warn_merge: booleanIf true, warn when a student’s history merged a stale handout.
-
directory: stringSubdirectory containing the problem set code. Use this when a user's repository contains data from multiple problem sets.
-
allow_directory_override: booleanIf true, allow detecting the problem set even when a student places code outside
directory. -
test_file: stringThe name of a file that should be present in the student’s repository (in the specified
directory, if any). Used to detect when a student ignores the subdirectory structure. -
repo_guess_patterns: array of stringsThese patterns are used to try to guess a student’s repository URL from their user name. If given, the array should contain a list of pattern, replacement pairs. The pattern is used to match against the student’s user name. If it does match, the corresponding replacement is used as a default repository URL. For example:
["^([_a-zA-Z0-9.]*s)$", "~$1/cs61/$1-cs61-psets", "^([_a-zA-Z0-9.]+)$", "~$1/cs61/$1s-cs61-psets"] -
grading_commit_function: stringPHP callback used to choose the grading commit for a student.
-
deadline: dateThe time at which the problem set is due.
-
deadline_college,deadline_extension: dateSeparate deadlines for college and extension students. If
deadlineis unset, it defaults todeadline_college(ordeadline_extension). -
obscure_late_hours: booleanIf true, then do not highlight when a commit is past the deadline.
-
no_late_hours: booleanIf true, suppress the automatic “late hours” grade entry.
Peteramati collects grades from teachers and displays them to students. The
grades setting, which is either a keyed object or an array, defines the
lines in the grading rubric.
The grades setting comprises a collection of entries. Each entry follows
this format.
-
key: string (defaults to the key ingrades)The internal name for the grade entry. This name is used in the database, so don’t change it after grades are assigned. Every entry for a problem set must have a unique name, and it cannot be a reserved name such as
totalorlate_hours. -
title: stringThe name shown for the grade entry. Defaults to
key. -
type: stringThe grade entry’s type. One of:
nullor"number"— a numeric grade (the default);"checkbox"— a single checkbox worthmaxpoints;"checkboxes","stars","poops"— 1–maxrepeated marks;"letter"— a letter grade (maxmust be 100);"select"— one of the strings inoptions;"text","shorttext","markdown"— free-form text;"section"— a heading that groups following entries;"timermark","duration"— time-based entries;"formula"— a computed grade (seeformula);"none"— no value (display only).
Custom types may be defined in the top-level
_grade_types. -
options: array of stringsThe choices for a
selectentry. -
formula: stringA grade formula. Setting
formulaimpliestype: "formula". -
round: stringFor numeric grades, how entered values are rounded:
"none","up","down", or"round". -
max: numberThe maximum number of points for this entry.
-
visible: boolean (or sethiddenfor the inverse)If false, students cannot see this grade (graders can). Defaults to true.
-
visible_if,suppressed_if: stringConditional visibility expressions.
-
max_visible: booleanIf false, students cannot see the value of
max(graders can). Defaults to true. -
answer: boolean (aliasstudent)If true, students can edit this grade (it is a student “answer”).
-
is_extra: booleanIf true, then this is an extra-credit entry.
-
no_total: boolean (or setin_totalfor the inverse)If true, then this grade is not included in the total. Some types (e.g.
letter,formula) are never in the total. -
required: booleanIf true, the entry must be filled in.
-
concealed: booleanIf true, the entry is concealed from students even where grades are shown.
-
order: number (aliasposition)Determines display order. Grade entries are sorted first by increasing
order, and second by the order they appear inpsets.json. Negativeorderentries appear first. -
collate: booleanIf true, then gradesheets allow selecting this grade for many students.
-
table_color: stringA background color for the entry’s column in gradesheets.
-
landmark: string, like"FILENAME:LINE"If set, then in diff display a text box for grade entry is placed underneath line FILENAME:LINE from the handout code.
-
landmark_range: string, like"FILENAME:LINE1:LINE2"A range of handout lines associated with the entry. Implies
collate. -
landmark_buttons: arrayButtons shown at the landmark, for quick grade entry.
-
timeout: interval;timeout_entry: stringFor
timermarkentries, the time limit and a companion entry. -
disabled: boolean;disabled_if: stringDisable the entry, unconditionally or by expression.
-
allow_edit_function,account_edit_function: stringPHP callbacks controlling who may edit the grade and how edits are accounted.
To reorder grade entries explicitly, set the problem set’s grade_order to an
array of grade keys.
These problem set settings control how grades are displayed.
-
scores_visible: boolean or date (aliasgrades_visible)Set to true to make grades visible to students. Implies
visible: true. -
grade_statistics_visible: boolean, date, or"grades"Set to true to make statistics of all grades visible to students, or false to hide them. Defaults to
"grades", which means visible when grades are visible. -
grade_cdf_cutoff: number between 0 and 1The CDF graph of grades is cut off below this number. The idea is to avoid unnecessary student distress. For example, if
grade_cdf_cutoffis 0.25, then students in the bottom quarter of the grade distribution will not be shown their exact standing within that quarter. -
separate_extension_grades: booleanIf true, then extension students are shown their performance relative to other extension students (as well as all students); for instance, grade CDFs will have a separate extension-only line.
-
grades_history: booleanIf true, retain a history of grade changes.
-
grades_selection_function: stringPHP callback used to select which grades apply.
The downloads setting defines downloadable files associated with a problem
set (for example, handout archives or test inputs). It is a keyed object of
download entries; each entry has this format.
-
key: string (defaults to the entry key)Internal identifier for the download.
-
title: stringDisplay title. Defaults to
key. -
file: string REQUIREDThe file to download.
-
filename: stringThe download’s suggested filename. Defaults to
key. -
visible: boolean, date, or"grades"When the download is offered to students.
-
timed: boolean;timeout: intervalIf
timed, the download starts a timer (e.g. for timed exams);timeoutsets the limit. -
order: number (aliasposition)Display order.
The top-level _formulas object defines named formulas usable across problem
sets. Each entry has this format.
-
name: stringThe formula’s identifier (usable in other formulas and grade entries).
-
title,description: stringHuman-readable name and description.
-
formula: stringThe formula expression.
-
visible: boolean (orhiddenfor the inverse)Whether the formula is shown to students.
-
nonzero: booleanIf true, the formula is only displayed when its value is nonzero.
-
home_order: number (aliashome_position)Display order on the home page.
Code display is controlled by the diffs problem set setting, which is an
object keyed by regular expression (or an array of objects with a match
key). For example:
"diffs": {
"README\\.txt": {"full": true, "order": -1},
"\\.gitignore|check\\.pl": {"collapse": true},
"out": {"ignore": true}
}This setting says:
-
Files named
README.txtwill be displayed in full (not as a diff), before other files (files by default have order 0). -
Files named
.gitignoreandcheck.plare collapsed. This means that diffs in these files will not be displayed by default. -
Files and directories named
outare entirely ignored; they will not appear in diffs at all.
Regular expressions must match full filename components, so the "out" entry
will not match a file named "out.txt".
Each diff entry may set:
-
match: string (aliasregex)The regular expression matched against filename components. Alternately, use
filenameto match a literal filename suffix, orextensionto match a filename extension (like".c"). -
title: stringA display title for the file.
-
priority: number (aliasmatch_priority)When several entries match a file, higher-priority entries win.
-
order: number (aliasposition);extension_order: numberDisplay order among files.
-
ignore: booleanOmit the file from diffs entirely.
-
full: booleanDisplay the file in full rather than as a diff.
-
collapse: booleanCollapse the file’s diff by default.
-
fileless: booleanTreat the entry as not corresponding to a real file.
-
gradable: booleanAllow line-by-line grade annotations on the file.
-
hide_if_anonymous: booleanHide the file when grading anonymously.
-
markdown,markdown_allowed: booleanRender the file as Markdown, or allow Markdown rendering as an option.
-
highlight,highlight_allowed: booleanSyntax-highlight the file, or allow highlighting as an option. (Peteramati highlights common languages by default based on filename.)
-
language: stringThe syntax-highlighting language.
-
tabwidth: integerTab width for display.
-
base: integer or stringThe diff base (e.g. a commit or handout reference) for this file.
The ignore setting is also available directly on the problem set as a
shorthand for files to ignore; "ignore": "*.txt" means the same as
"diffs": {".*\\.txt": {"ignore": true}}The problem set’s diff_base setting chooses a default diff base for all files.
Peteramati can run student code in a Linux container and log and display the
results. This is controlled by the runners problem set setting, which is a
keyed object of run entries. A default_runner object supplies defaults for
every runner, and runner_order (an array of names) reorders them.
Code running requires significant additional configuration; see runners.md and pajail.md.
A run entry is an object following this format.
-
name: string (defaults to the key inrunners)The internal name for the runner. This name is used in the database, so don’t change it or information will be lost. Every runner in a problem set must have a unique name. The name should consist only of letters, digits, and underscores, and must start with a letter.
-
title: stringThe display title for the runner. Defaults to
name. -
display_title: stringThe display title for the runner’s output. Defaults to “
titleoutput”. -
disabled: booleanIf true, then the runner is hidden from users.
-
visible: boolean, date, or"grades"If true, then the runner is displayed to, and executable by, students as well as teachers. If set to
"grades", then the runner is displayed to students iff grades are visible to students. -
display_visible: boolean, date, or"grades"If true, then the runner’s output is displayed to students. This can be set even if the runner itself is not visible.
-
order: number (aliasposition)Determines display order. Runners are sorted first by increasing
order, and second by the order they appear inpsets.json. Negativeorderentries appear first. -
transfer_warnings: boolean or"grades"If true, then search runner output for text that looks like compiler warnings, and display any such warnings in the problem set diffs. If
"grades", then students can see these warnings when grades are visible, even if they cannot see the runner output. -
transfer_warnings_priority: numberPriority for transferred warnings.
-
xterm_js: booleanIf true, use
xterm.jsinstead of peteramati’s built-in terminal. -
rows,columns,font_size: integerTerminal geometry for display.
-
timed_replay: boolean or number;timed_replay_start: stringReplay recorded output with timing. A number sets the replay speed.
A runner can optionally run code inside a container on the peteramati host.
This depends on the suid-root pa-jail program in the jail subdirectory; see
pajail.md.
-
command: stringThe command to run.
-
username: stringThe username under which the command runs. Defaults to the problem set’s
run_usernamekey, orjail61userif that is not set. -
overlay: string, object, or arrayTarball(s) to extract over student code—for example, to replace files with pristine versions or add grading code. An object form takes a
fileand an optionalexcludelist. Defaults to the problem set’srun_overlay. -
timeout: intervalTimeout after which the container will shut down. Defaults to the problem set’s
run_timeout, or 10 minutes. If ≤0, there is no timeout. -
idle_timeout: intervalTimeout after which the container will shut down if idle (no input or output). Defaults to the problem set’s
run_idle_timeout, or 3 minutes. If ≤0, there is no timeout. -
queue: string;nconcurrent: integerOptional run queue (defined in the top-level
_queues) and a limit on the number of concurrent runners in it. -
rerun_timestamp: boolean or dateForce reruns of cached output produced before this time.
The problem set also carries run defaults used when a runner does not set its
own: run_username, run_overlay, run_timeout, run_idle_timeout,
run_dirpattern, run_skeletondir, run_binddir, run_jailfiles,
run_jailmanifest, and run_xterm_js.
A runner may post-process its output with PHP callbacks.
-
require: string (aliasload);ensure: string or array of stringsPHP file(s) to load before evaluation.
-
evaluate_function: string (aliaseval)PHP callback that evaluates the run, e.g. to compute a grade.
-
display_function: string (aliasoutput_function)PHP callback that customizes how the run’s output is displayed.
Several settings have been renamed. The old names are now errors (unless the
allowObsoleteConfig option is set). The most common renames:
| current name | old name |
|---|---|
weight |
group_weight |
removed |
ui_disabled |
visible |
show_to_students |
scores_visible |
show_grades_to_students |
grade_statistics_visible |
grade_cdf_visible |
frozen |
freeze |
handout_branch |
handout_repo_branch |
handout_hash |
handout_commit_hash |
repo_guess_patterns |
repo_transform_patterns |
deadline_college |
college_deadline |
deadline_extension |
extension_deadline |
display_title |
output_title (runner) |
display_visible |
output_visible (runner) |
collapse |
boring (diff) |
gradable |
gradeable (diff) |