Skip to content

Commit d54ead5

Browse files
authored
Merge pull request #26 from problem-judge/readme
Add readme with installation instruction
2 parents 9889f19 + 0bc5269 commit d54ead5

File tree

7 files changed

+197
-0
lines changed

7 files changed

+197
-0
lines changed

configs/client-config-example.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Address: # Enter address to run client.
2+
3+
MasterConnection:
4+
Address: # Address on which the testing system is started.
5+
6+
StorageConnection:
7+
Address: # Address on which the testing system is started.
8+
9+
DB:
10+
Dsn: # Use your postgres dsn to connect to database.
11+
12+
ResourcesPath: # Path of folder "clients/resources" in testing system repository
13+
14+
Admin: true # Use this parameter to set up admin frontend client, it will be available at path /admin
15+
TestingSystemAPI:
16+
DefaultLoadFilesHead: 100 # Number of first bytes to load for each file that is served.
17+

configs/compiler/config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Languages:
2+
cpp:
3+
Template: "cpp.sh.tmpl"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
g++ "{{.source}}" -std=c++20 -O2 -o "{{.binary}}"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Port: # enter the port to run the invoker
2+
# Host: "enter the host string value" # By default, Host equals to localhost
3+
4+
Logger:
5+
# LogPath: "path to save logs" # By default, logs are written to stdout and stderr
6+
# LogLevel: 0. # By default LogLevel is 0.
7+
# Possible log levels are: 0 (Trace), 1 (Debug), 2 (Info), 3 (Warn), 4 (Error)
8+
9+
Invoker:
10+
# AutodetectPublicAddress is used to automatically detect public address of invoker.
11+
# This address will be used for master to communicate with invoker.
12+
# With this parameter, the configuration file can be the same for all invokers that are started in some cloud service.
13+
AutodetectPublicAddress: true
14+
# Threads defines the number of simultaneous processes allowed to run at the same time.
15+
# It is strongly recommended to keep this config equal to 1
16+
Threads: 1
17+
# Sandboxes defines the number of simultaneous test runs that are processed at the same time.
18+
# The best value for this parameter is Threads * 2
19+
Sandboxes: 2
20+
# QueueSize defines the number of test runs that are added to invoker and their resources are loading.
21+
# The best value for this parameter is 1, but for slow networks it can be grater
22+
QueueSize: 1
23+
# SandboxType defines the type of sandbox used for process isolation. Possible values are "isolate" and "simple"
24+
# It is strongly recommended to use "isolate" for safe process execution
25+
SandboxType: "isolate"
26+
# CacheSize defines the size of the cached files (in bytes). It is recommended to have it al least 10^9 or more.
27+
CacheSize: 1000000000
28+
# SaveOutputHead defines the number of bytes that should be saved for each resource, produced by solution.
29+
# If this parameter is absent, the full content of each resource will be saved.
30+
SaveOutputHead: 100
31+
# SandboxHomePath is the path to directory for some sandbox specific files. This directory should be empty.
32+
SandboxHomePath: "some path to empty directory"
33+
# SandboxHomePath is the path to directory for cached files. This directory should be empty.
34+
# The cache is reset at each invoker restart.
35+
CachePath: "some cache path to empty directory"
36+
# CompilerConfigsFolder is the path to directory, containing compiler configs (just like the folder configs/compiler)
37+
CompilerConfigsFolder: "path to compiler configs"
38+
# MasterPingInterval: 1s # The interval at which invoker pings master. By default, equal to 1s
39+
40+
DB:
41+
Dsn: # Use your postgres dsn on master server to connect to database.
42+
43+
MasterConnection:
44+
Address: # Public address of master server
45+
46+
StorageConnection:
47+
Address: # Public address of master server

configs/config-master-example.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Port: # enter the port to run the testing system
2+
# Host: "enter the host string value" # By default, Host equals to localhost
3+
4+
Logger:
5+
# LogPath: "path to save logs" # By default, logs are written to stdout and stderr
6+
# LogLevel: 0. # By default LogLevel is 0.
7+
# Possible log levels are: 0 (Trace), 1 (Debug), 2 (Info), 3 (Warn), 4 (Error)
8+
9+
Master:
10+
# InvokersPingInterval defines the interval at which invokers should be pinged.
11+
InvokersPingInterval: 1s
12+
13+
Storage:
14+
# StoragePath defines the path to store all resources.
15+
StoragePath: "some path to folder containing all the resources"
16+
17+
DB:
18+
Dsn: "postgresql://localhost:5432/ts" # Use your postgres dsn to connect to database.
19+
20+
MasterConnection:
21+
Address: "http://localhost:<port>" # Use the port that is defined in Port parameter for testing system.
22+
23+
StorageConnection:
24+
Address: "http://localhost:<port>" # Use the port that is defined in Port parameter for testing system.

configs/config-single-example.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
Port: # enter the port to run the testing system
2+
# Host: "enter the host string value" # By default, Host equals to localhost
3+
4+
Logger:
5+
# LogPath: "path to save logs" # By default, logs are written to stdout and stderr
6+
# LogLevel: 0. # By default LogLevel is 0.
7+
# Possible log levels are: 0 (Trace), 1 (Debug), 2 (Info), 3 (Warn), 4 (Error)
8+
9+
Invoker:
10+
# Threads defines the number of simultaneous processes allowed to run at the same time.
11+
# It is strongly recommended to keep this config equal to 1
12+
Threads: 1
13+
# Sandboxes defines the number of simultaneous test runs that are processed at the same time.
14+
# The best value for this parameter is Threads * 2
15+
Sandboxes: 2
16+
# QueueSize defines the number of test runs that are added to invoker and their resources are loading.
17+
# The best value for this parameter is 1, but for slow networks it can be grater
18+
QueueSize: 1
19+
# SandboxType defines the type of sandbox used for process isolation. Possible values are "isolate" and "simple"
20+
# It is strongly recommended to use "isolate" for safe process execution
21+
SandboxType: "isolate"
22+
# CacheSize defines the size of the cached files (in bytes). It is recommended to have it al least 10^9 or more.
23+
CacheSize: 1000000000
24+
# SaveOutputHead defines the number of bytes that should be saved for each resource, produced by solution.
25+
# If this parameter is absent, the full content of each resource will be saved.
26+
SaveOutputHead: 100
27+
# SandboxHomePath is the path to directory for some sandbox specific files. This directory should be empty.
28+
SandboxHomePath: "some path to empty directory"
29+
# SandboxHomePath is the path to directory for cached files. This directory should be empty.
30+
# The cache is reset at each invoker restart.
31+
CachePath: "some cache path to empty directory"
32+
# CompilerConfigsFolder is the path to directory, containing compiler configs (just like the folder configs/compiler)
33+
CompilerConfigsFolder: "path to compiler configs"
34+
# MasterPingInterval: 1s # The interval at which invoker pings master. By default, equal to 1s
35+
36+
Master:
37+
# InvokersPingInterval defines the interval at which invokers should be pinged.
38+
InvokersPingInterval: 1s
39+
40+
Storage:
41+
# StoragePath defines the path to store all resources.
42+
StoragePath: "some path to folder containing all the resources"
43+
44+
DB:
45+
Dsn: "postgresql://localhost:5432/ts" # Use your postgres dsn to connect to database.
46+
47+
MasterConnection:
48+
Address: "http://localhost:<port>" # Use the port that is defined in Port parameter for testing system.
49+
50+
StorageConnection:
51+
Address: "http://localhost:<port>" # Use the port that is defined in Port parameter for testing system.

readme.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Testing system
2+
3+
This is a fast testing system for programming tasks.
4+
5+
## Installation
6+
7+
The testing system can be used at any linux repository.
8+
9+
You will need go 1.24 to build the testing system.
10+
You will need postgres for database.
11+
You will also need [isolate](https://github.com/ioi/isolate) for code isolation.
12+
13+
To install testing system, download the repository. Then run command:
14+
15+
```shell
16+
go build ./
17+
```
18+
19+
To run the testing system, use command:
20+
21+
```shell
22+
./testing_system <config.yaml file path>
23+
```
24+
25+
There are two ways to configure testing system:
26+
27+
- Single process run. For this configuration, use the file `configs/config-single-example.yaml` as a base for config. You can read the comments in config to configure testing system correctly.
28+
- Multiple server run.
29+
For this configuration, there should be master server where the master component of testing system is set up,
30+
and there can be multiple invoker servers for invokers.
31+
For config files, use `config/config-master-example.yaml` for master server config
32+
and `config/config-invoker-example.yaml` for invoker server config.
33+
34+
### Client configuration
35+
36+
For client build, use command:
37+
38+
```shell
39+
go build ./clients
40+
```
41+
42+
To run the client, run compiled binary with config as a first argument.
43+
The config can be produced from `configs/client-config-example.yaml`.
44+
45+
### Polygon import
46+
47+
To import problems from polygon, you can use `tools/polygon_importer`.
48+
It should be run with the following command:
49+
```shell
50+
polygon_importer <testing system config path> <polygon ID of problem> <polygon API key> <polygon API secret>
51+
```
52+

0 commit comments

Comments
 (0)