Tulip

Tulip is a part of Project Polya. It is the endpoint program, which is responsible for creating the judge environment and running the student project.
You can visit the repository here.
Tulip is also available at crates.io. You can install it via:
cargo install tulip --forceOverview
tulip 0.1.0
USAGE:
tulip [OPTIONS] <SUBCOMMAND>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-l, --log-level <log-level> The log level [env: TULIP_LOG_LEVEL=] [default: info] [possible values: error,
trace, info, debug, off, warn]
-n, --nutshell <nutshell> Path to nutshell binary [env: NUTSHELL_BIN=] [default: nutshell]
-t, --tulip-dir <tulip-dir> The work directory of tulip [env: TULIP_DIR=] [default: .tulip]
SUBCOMMANDS:
auto-current Auto run the current project
build Build the current project
clean-all Unregister the client and clean up local environment
clear Clear the current project
comment Open the comment editor
destroy-overlay Delete the current overlay system
enter-sandbox Manually enter the sandbox
fetch Fetch student project
grade Give a grade to the student
help Prints this message or the help of the given subcommand(s)
init-overlay Initialize the overlay filesystem
mark Mark the current project
pull Pull the target student project
pull-image Pull the base image
refresh-config Refresh the global config
register Register this client
report Read the report
run Build the current project
skip Skip the current project
status See the current status
submit Edit current global settingsRequirements for Use
Linuxis required.nutshellis installed and put in thePATH.One of
aria2candwgetis ready.opensslis usable forhttps.sudois within thePATHand you have the right to become the root.systemd-nspawnandfirejailis required for sandbox.
Requirements for Build
Linuxis required.- Make sure your rust tool-chain is functioning.
cmakeis installed andc/c++development environment is ready to be invoked bycargo.
Environment Variables
The following variables are optional and they can also be passed as command-line arguments:
TULIP_LOG_LEVELThe log level oftulip, set toinfoby default. It is recommended to set a level finer thanwarn. Possible values:off
error
warn
info
debug
trace
TULIP_REPORT_READERThe application to open student report, set toxdg-openby default.NUTSHELL_BINPath to thenutshellexecutable, set tonutshellby default.TULIP_DIRThe work directory oftulip, set.tulipby defaultTULIP_MOUNT_DIRThe mount directory of the temporaryoverlayfs. Attention: This is set to\mntbe default
The following system wise variables are used:
EDITORwill be used when editing configurations if it is set
The following variables must be provided or passed as command-line arguments:
TULIP_SERVERwill be used when registering if it is setTULIP_TOKENwill be used when registering if it is set
About the Status of Grading
Once a project is fetched it is locked by the fetcher.
The project can be unlocked by
commit/skip/revoke, where the last operation is included inclean-all.pullis always allowed. However,pullwill not lock the project, you will always need to use--overrideflag to update the remote status if the current project is pulled rather than fetched.commitcan be used to commit the current project. However, if a previous submission exists,--overrideflag must be set.fetchwill automatically get the next untouched project.skipcan ignore the current project and unlock it. However, once a project isskipped, it can only be pulled and will not be put into the fetch-able list.
About the Procedure of Grading
You need to register a UUID at the very beginning.
You should pull an image before grading. The default
pull-imagewill download the image and the global configurations. However, both of them can be set locally.imagecan be set by putting the image to<workdir>/image/image.sfsand invoking thepull-imagesubcommand with--local-setglobal-configcan be set bytulip status edit-global
Now, you can either pull or fetch a project. When pulling, you can use
tulip status remote [--detail]ortulip status remote-id --id <student id>. If you experience a download error when fetching the project file or you just want to update the current project info, you can usetulip fetch --download-onlyHow, you can initialize the overlay. The student files are
rsyncedinto the/datadirectory in the chroot environment.You can run
buildsubcommand to build the project.You can run
runsubcommand to run the project.You can use
commentsubcommand to leave a comment.You can use
grade -s <score>subcommand to grade the project.You can use
mark [-r]subcommand to mark/unmark the project.You can use
commit/skipsubcommand to submit/skip the project.You can use
reportsubcommand to read the report of the student.During the whole procedure, you can use
enter-sandboxto enter the sandbox, bothfirejailandsystemd-nspawn.After a local project is set, building-running-report process can be invoked in a whole by the
auto-currentsubcommand.
Notice
There are a lot of more details: for example, you can force to rebuild, force to re-grade, directly edit the status, etc. All the features are described in detail in the CLI. Feel free to invoke the CLI with --help whenever you feel confused.