Skip to content

Commit

Permalink
Document globs and DMOJ_PROBLEM_DATA_ROOT; closes #99
Browse files Browse the repository at this point in the history
  • Loading branch information
kiritofeng authored Jan 23, 2023
1 parent 246683d commit f1e816e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
11 changes: 6 additions & 5 deletions docs/judge/judge_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ The runtimes are configured with a `runtime` node. While most runtimes can be au

## Problems

The problems are configured with `problem_storage_root`. There are three ways to configure this node:

1. A single string: all grandchildren directories which include an `init.yml` will be treated as a problem directory.
2. A list: all children of each element in the list will be treated as a problem directory.
3. A dictionary: the key is an integer and the value is a string. The n-th level children of the string will be considered problem directories, where `n` is the entry's key.
The problems are configured with `problem_storage_globs`. This is a list of (potentially recursive) globs, as defined by Python's `glob` library.
Any folders that match any of the listed globs and contain an `init.yml` will be treated as a problem directory.
For example:
- `/mnt/problems/folder1/*` will match `/mnt/problems/folder1/problem1`.
- `/mnt/problems/folder2/**/` will match all subfolders of `/mnt/problems/folder2`, e.g. `/mnt/problems/folder2/foo/bar/problem2`.
- `/mnt/problems/folder3/year20[0-9][0-9]` will match `/mnt/problems/folder3/year2023`.

## ID

Expand Down
5 changes: 5 additions & 0 deletions docs/site/managing_problems.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
The DMOJ comes with an online interface for creating and editing problem statements as well as data.
This guide is intended as an introduction to using these features for creating your own problems.

## Configuring site-managed data

Set `DMOJ_PROBLEM_DATA_ROOT` to a folder of your choice.
The test data for all problems with site-managed data will be stored within this folder.

## Adding a problem

To start, head to [/admin/](https://dmoj.ca/admin/) and use your credentials to log in.
Expand Down
9 changes: 5 additions & 4 deletions sample_files/judge_conf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ id: ExampleJudge
# The key this judge will use to authenticate with the site server, generated from the admin panel.
key: "100/Base64/characters/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMN"
# Where to look for problems on the local filesystem.
# This directory is /not/ scanned recursively, and any directory containing an init.yml file is assumed to
# be a problem directory.
problem_storage_root:
- /home/sync/problems
# Any directory matching any of the following globs with an init.yml file is assumed to be a problem directory.
problem_storage_globs:
- /mnt/problems/folder1/* # matches /mnt/problems/folder1/<problem>
- /mnt/problems/folder2/**/ # matches any subfolder of /mnt/problems/folder2
- /mnt/problems/folder3/year20[0-9][0-9] # matches /mnt/problems/folder3/year2023, for example
# All configuration for language executors.
# If you're unsure of what values a language needs, your best bet is to consult the source of the executor:
# <https://github.com/DMOJ/judge-server/tree/master/dmoj/executors>
Expand Down

0 comments on commit f1e816e

Please sign in to comment.