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 defining problem sets, plus
other configuration information. 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 _defaults
entry defines
entries common to the problem sets.
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 the _defaults
object, if any.
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.
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 shorter1
for URIs, sincepeteramati/pset/pset1
looks redundant.
-
title
: stringHuman-friendly problem set name. This is the name displayed in the interface. Defaults to the problem set's JSON key.
-
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.
-
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.
-
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. -
partner_repo
: stringIf
"same"
(the default), partners should have the same repository. If"different"
, partners should have different repositories. -
handout_repo_url
: stringGit URL for handout code.
-
handout_hash
: stringCommit hash to use for handout code and diffs. If not set, diffs are shown relative to 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_hash
is used; if that’s not set, the latest handout commit is used. -
directory
: stringSubdirectory containing the problem set code. Use this when a user's repository contains data from multiple problem sets.
-
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"]
-
deadline
: dateThe time at which the problem set is due.
-
obscure_late_hours
: booleanIf true, then do not highlight when a commit is past the deadline.
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.
-
name
: string (REQUIRED but 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.
-
title
: stringThe name shown for the grade entry.
-
type
: stringnull,
"number"
,"text"
,"checkbox"
,"letter"
,"select"
, or"formula"
-
round
: stringnull,
"none"
,"up"
,"down"
, or"round"
-
max
: numberThe maximum number of points for this entry.
-
visible
: booleanIf set explicitly to false, then students cannot see this grade (graders can). Defaults to true.
-
max_visible
: booleanIf set explicitly to false, then students cannot see the value of
max
(graders can). Defaults to true. -
formula
: string -
student
: booleanIf true, then students can edit this grade.
-
is_extra
: booleanIf true, then this is an extra-credit entry.
-
no_total
: booleanIf true, then this grade is not included in the total.
-
order
: numberDetermines display order. Grade entries are sorted first by increasing
order
, and second by the order they appear inpsets.json
. Negativeorder
entries appear first. -
landmark
: string, like "FILENAME:LINE" or "FILENAME:LINE1:LINE:LINE2"If set, then in diff display, a text box for grade entry will be placed underneath line FILENAME:LINE from the handout code.
These other problem set components relate to grade display.
-
scores_visible
: boolean or dateSet 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 it. 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_cutoff
is 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.
Code display is controlled by the diffs
problem set setting, which is an
object keyed by regular expression. For example:
"diffs": {
"README\\.txt": {"full": true, "order": -1},
"\\.gitignore|check\\.pl": {"collapse": true},
"out": {"ignore": true}
}
This setting says:
-
Files named
README.txt
will be displayed in full (not as a diff), before other files (files by default have order 0). -
Files named
.gitignore
andcheck.pl
are collapsed. This means that diffs in these files will not be displayed by default. -
Files and directories named
out
are 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"
.
Alternately, the ignore
setting is a shorthand way of specifying files to
ignore; the setting "ignore": "*.txt"
means the same as
"diffs": {".*\\.txt": {"ignore": true}}
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.
Code running requires significant additional configuration; see runners.md.
A run entry is an object following this format.
-
name
: string (REQUIRED but 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
. -
output_title
: stringThe display title for the runner’s output. Defaults to “
name
output”. -
disabled
: booleanIf true, then the runner is hidden from users.
-
visible
: boolean, date, orgrades
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. -
output_visible
: boolean, date, orgrades
If true, then the output of the runner is displayed to students. This can be set even if the runner itself is not visible.
-
order
: numberDetermines display order. Runners are sorted first by increasing
order
, and second by the order they appear inpsets.json
. Negativeorder
entries appear first.
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.
-
username
: stringThe username under which the command runs. Defaults to the problem set’s
run_username
key, orjail61user
if that is not set. -
command
: stringThe command to run.
-
overlay
: stringOptional tarball to extract over student code. This can be used to, for example, replace files with pristine versions or add grading code.
-
timeout
: interval (number or string like10m
or20s
)Timeout after which the container will shut down. Defaults to 10 minutes. If set to ≤0, there is no timeout.
-
idle_timeout
: interval (number or string like10m
or20s
)Timeout after which the container will shut down if idle (no input or output). Defaults to 3 minutes. If set to ≤0, there is no timeout.
-
queue
: stringOptional run queue. If set, …
-
nconcurrent
: integerOptional limit on number of concurrent runners. Requires
queue
to be set. -
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
-
xterm_js
: booleanIf true, use
xterm.js
instead of peteramati’s built-in terminal.
XXX how is code unpacked
XXX .gitcheckout
XXX run queue configuration
-
require
: stringXXX
-
eval
: stringPHP callback. XXX
XXX arguments to PHP callback