From 0bc5269eb151ec1cfe435ddf2eb0a05686be0002 Mon Sep 17 00:00:00 2001 From: Philip Gribov Date: Wed, 21 May 2025 18:23:53 +0300 Subject: [PATCH] Add readme with installation instruction --- configs/client-config-example.yaml | 17 +++++++++ configs/compiler/config.yaml | 3 ++ configs/compiler/scripts/cpp.sh.tmpl | 3 ++ configs/config-invoker-example.yaml | 47 +++++++++++++++++++++++++ configs/config-master-example.yaml | 24 +++++++++++++ configs/config-single-example.yaml | 51 +++++++++++++++++++++++++++ readme.md | 52 ++++++++++++++++++++++++++++ 7 files changed, 197 insertions(+) create mode 100644 configs/client-config-example.yaml create mode 100644 configs/compiler/config.yaml create mode 100644 configs/compiler/scripts/cpp.sh.tmpl create mode 100644 configs/config-invoker-example.yaml create mode 100644 configs/config-master-example.yaml create mode 100644 configs/config-single-example.yaml create mode 100644 readme.md diff --git a/configs/client-config-example.yaml b/configs/client-config-example.yaml new file mode 100644 index 0000000..61d1c96 --- /dev/null +++ b/configs/client-config-example.yaml @@ -0,0 +1,17 @@ +Address: # Enter address to run client. + +MasterConnection: + Address: # Address on which the testing system is started. + +StorageConnection: + Address: # Address on which the testing system is started. + +DB: + Dsn: # Use your postgres dsn to connect to database. + +ResourcesPath: # Path of folder "clients/resources" in testing system repository + +Admin: true # Use this parameter to set up admin frontend client, it will be available at path /admin +TestingSystemAPI: + DefaultLoadFilesHead: 100 # Number of first bytes to load for each file that is served. + diff --git a/configs/compiler/config.yaml b/configs/compiler/config.yaml new file mode 100644 index 0000000..f0a2cb3 --- /dev/null +++ b/configs/compiler/config.yaml @@ -0,0 +1,3 @@ +Languages: + cpp: + Template: "cpp.sh.tmpl" \ No newline at end of file diff --git a/configs/compiler/scripts/cpp.sh.tmpl b/configs/compiler/scripts/cpp.sh.tmpl new file mode 100644 index 0000000..4666161 --- /dev/null +++ b/configs/compiler/scripts/cpp.sh.tmpl @@ -0,0 +1,3 @@ +#!/bin/bash + +g++ "{{.source}}" -std=c++20 -O2 -o "{{.binary}}" diff --git a/configs/config-invoker-example.yaml b/configs/config-invoker-example.yaml new file mode 100644 index 0000000..87e6944 --- /dev/null +++ b/configs/config-invoker-example.yaml @@ -0,0 +1,47 @@ +Port: # enter the port to run the invoker +# Host: "enter the host string value" # By default, Host equals to localhost + +Logger: + # LogPath: "path to save logs" # By default, logs are written to stdout and stderr + # LogLevel: 0. # By default LogLevel is 0. + # Possible log levels are: 0 (Trace), 1 (Debug), 2 (Info), 3 (Warn), 4 (Error) + +Invoker: + # AutodetectPublicAddress is used to automatically detect public address of invoker. + # This address will be used for master to communicate with invoker. + # With this parameter, the configuration file can be the same for all invokers that are started in some cloud service. + AutodetectPublicAddress: true + # Threads defines the number of simultaneous processes allowed to run at the same time. + # It is strongly recommended to keep this config equal to 1 + Threads: 1 + # Sandboxes defines the number of simultaneous test runs that are processed at the same time. + # The best value for this parameter is Threads * 2 + Sandboxes: 2 + # QueueSize defines the number of test runs that are added to invoker and their resources are loading. + # The best value for this parameter is 1, but for slow networks it can be grater + QueueSize: 1 + # SandboxType defines the type of sandbox used for process isolation. Possible values are "isolate" and "simple" + # It is strongly recommended to use "isolate" for safe process execution + SandboxType: "isolate" + # CacheSize defines the size of the cached files (in bytes). It is recommended to have it al least 10^9 or more. + CacheSize: 1000000000 + # SaveOutputHead defines the number of bytes that should be saved for each resource, produced by solution. + # If this parameter is absent, the full content of each resource will be saved. + SaveOutputHead: 100 + # SandboxHomePath is the path to directory for some sandbox specific files. This directory should be empty. + SandboxHomePath: "some path to empty directory" + # SandboxHomePath is the path to directory for cached files. This directory should be empty. + # The cache is reset at each invoker restart. + CachePath: "some cache path to empty directory" + # CompilerConfigsFolder is the path to directory, containing compiler configs (just like the folder configs/compiler) + CompilerConfigsFolder: "path to compiler configs" + # MasterPingInterval: 1s # The interval at which invoker pings master. By default, equal to 1s + +DB: + Dsn: # Use your postgres dsn on master server to connect to database. + +MasterConnection: + Address: # Public address of master server + +StorageConnection: + Address: # Public address of master server diff --git a/configs/config-master-example.yaml b/configs/config-master-example.yaml new file mode 100644 index 0000000..c8e66dc --- /dev/null +++ b/configs/config-master-example.yaml @@ -0,0 +1,24 @@ +Port: # enter the port to run the testing system +# Host: "enter the host string value" # By default, Host equals to localhost + +Logger: + # LogPath: "path to save logs" # By default, logs are written to stdout and stderr + # LogLevel: 0. # By default LogLevel is 0. + # Possible log levels are: 0 (Trace), 1 (Debug), 2 (Info), 3 (Warn), 4 (Error) + +Master: + # InvokersPingInterval defines the interval at which invokers should be pinged. + InvokersPingInterval: 1s + +Storage: + # StoragePath defines the path to store all resources. + StoragePath: "some path to folder containing all the resources" + +DB: + Dsn: "postgresql://localhost:5432/ts" # Use your postgres dsn to connect to database. + +MasterConnection: + Address: "http://localhost:" # Use the port that is defined in Port parameter for testing system. + +StorageConnection: + Address: "http://localhost:" # Use the port that is defined in Port parameter for testing system. diff --git a/configs/config-single-example.yaml b/configs/config-single-example.yaml new file mode 100644 index 0000000..558e8fd --- /dev/null +++ b/configs/config-single-example.yaml @@ -0,0 +1,51 @@ +Port: # enter the port to run the testing system +# Host: "enter the host string value" # By default, Host equals to localhost + +Logger: + # LogPath: "path to save logs" # By default, logs are written to stdout and stderr + # LogLevel: 0. # By default LogLevel is 0. + # Possible log levels are: 0 (Trace), 1 (Debug), 2 (Info), 3 (Warn), 4 (Error) + +Invoker: + # Threads defines the number of simultaneous processes allowed to run at the same time. + # It is strongly recommended to keep this config equal to 1 + Threads: 1 + # Sandboxes defines the number of simultaneous test runs that are processed at the same time. + # The best value for this parameter is Threads * 2 + Sandboxes: 2 + # QueueSize defines the number of test runs that are added to invoker and their resources are loading. + # The best value for this parameter is 1, but for slow networks it can be grater + QueueSize: 1 + # SandboxType defines the type of sandbox used for process isolation. Possible values are "isolate" and "simple" + # It is strongly recommended to use "isolate" for safe process execution + SandboxType: "isolate" + # CacheSize defines the size of the cached files (in bytes). It is recommended to have it al least 10^9 or more. + CacheSize: 1000000000 + # SaveOutputHead defines the number of bytes that should be saved for each resource, produced by solution. + # If this parameter is absent, the full content of each resource will be saved. + SaveOutputHead: 100 + # SandboxHomePath is the path to directory for some sandbox specific files. This directory should be empty. + SandboxHomePath: "some path to empty directory" + # SandboxHomePath is the path to directory for cached files. This directory should be empty. + # The cache is reset at each invoker restart. + CachePath: "some cache path to empty directory" + # CompilerConfigsFolder is the path to directory, containing compiler configs (just like the folder configs/compiler) + CompilerConfigsFolder: "path to compiler configs" + # MasterPingInterval: 1s # The interval at which invoker pings master. By default, equal to 1s + +Master: + # InvokersPingInterval defines the interval at which invokers should be pinged. + InvokersPingInterval: 1s + +Storage: + # StoragePath defines the path to store all resources. + StoragePath: "some path to folder containing all the resources" + +DB: + Dsn: "postgresql://localhost:5432/ts" # Use your postgres dsn to connect to database. + +MasterConnection: + Address: "http://localhost:" # Use the port that is defined in Port parameter for testing system. + +StorageConnection: + Address: "http://localhost:" # Use the port that is defined in Port parameter for testing system. diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..b2684b1 --- /dev/null +++ b/readme.md @@ -0,0 +1,52 @@ +# Testing system + +This is a fast testing system for programming tasks. + +## Installation + +The testing system can be used at any linux repository. + +You will need go 1.24 to build the testing system. +You will need postgres for database. +You will also need [isolate](https://github.com/ioi/isolate) for code isolation. + +To install testing system, download the repository. Then run command: + +```shell +go build ./ +``` + +To run the testing system, use command: + +```shell +./testing_system +``` + +There are two ways to configure testing system: + +- 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. +- Multiple server run. +For this configuration, there should be master server where the master component of testing system is set up, +and there can be multiple invoker servers for invokers. +For config files, use `config/config-master-example.yaml` for master server config +and `config/config-invoker-example.yaml` for invoker server config. + +### Client configuration + +For client build, use command: + +```shell +go build ./clients +``` + +To run the client, run compiled binary with config as a first argument. +The config can be produced from `configs/client-config-example.yaml`. + +### Polygon import + +To import problems from polygon, you can use `tools/polygon_importer`. +It should be run with the following command: +```shell +polygon_importer +``` +