github.com/Myriad-Dreamin/tarus@v0.0.0-20220422082640-5379b6998284/README.md (about) 1 ## Tarus 2 3 Online Judge Engine Powered by runC, gVisor and other execution runtime. 4 5 ## Take a glance 6 7 The only prerequisite is downloading and run [containerd](https://containerd.io/downloads/), which works on distribution 8 of any Linux or WSL. 9 10 ```shell 11 $ containerd # run containerd service 12 INFO[2022-03-31T03:38:38.222472900+08:00] starting containerd revision=10f428dac7cec44c864e1b830a4623af27a9fc70 version=v1.6.1 13 ... 14 INFO[2022-03-31T03:38:38.243084903+08:00] serving... address=/run/containerd/containerd.sock.ttrpc 15 INFO[2022-03-31T03:38:38.243109172+08:00] Start recovering state 16 INFO[2022-03-31T03:38:38.243127039+08:00] serving... address=/run/containerd/containerd.sock 17 INFO[2022-03-31T03:38:38.243172865+08:00] containerd successfully booted in 0.021098s 18 INFO[2022-03-31T03:38:38.253966164+08:00] Start event monitor 19 INFO[2022-03-31T03:38:38.254040667+08:00] Start snapshots syncer 20 INFO[2022-03-31T03:38:38.254070786+08:00] Start cni network conf syncer for default 21 INFO[2022-03-31T03:38:38.254096571+08:00] Start streaming server 22 $ git clone https://github.com/Myriad-Dreamin/tarus 23 $ cd tarus 24 $ go run ./cmd/tarus # run tarus service 25 $ go run ./cmd/tarus-cli submit \ 26 --driver domjudge,problem=fuzzers/corpora/domjudge/bapc2019-A \ 27 --submission fuzzers/corpora/domjudge/bapc2019-A/submissions/accepted/nicky.cpp 28 # run tarus client, served by tarus daemon 29 Response: []tarus_app.JudgeResult{ 30 tarus_app.JudgeResult{ 31 Index: "0:AAA", 32 Status: "Accepted/0s/16ms/5.270MB", 33 }, 34 tarus_app.JudgeResult{ 35 Index: "1:AQA", 36 Status: "Accepted/0s/21ms/3.977MB", 37 }, 38 tarus_app.JudgeResult{ 39 Index: "2:AgA", 40 Status: "Accepted/130ms/153ms/12.766MB", 41 }, 42 ... 43 tarus_app.JudgeResult{ 44 Index: "31:HwA", 45 Status: "Accepted/150ms/191ms/9.469MB", 46 }, 47 } 48 $ go run ./cmd/tarus-cli submit \ 49 --integrated-service oci:containerd \ 50 --driver domjudge,problem=fuzzers/corpora/domjudge/bapc2019-A \ 51 --submission fuzzers/corpora/domjudge/bapc2019-A/submissions/accepted/nicky.cpp 52 # embedded tarus service 53 Response: []tarus_app.JudgeResult{ 54 tarus_app.JudgeResult{ 55 Index: "0:AAA", 56 Status: "Accepted/0s/10ms/6.205MB", 57 }, 58 ... 59 } 60 ``` 61 62 ## Design 63 64 The Judge Service is defined in GRPC Service, hence both embedded service and remote service are supported. And, the 65 OCI Standard has been implemented as a tarus judge service (runtime), so most oci-runtime are soon available in this 66 framework, including [runC](https://github.com/opencontainers/runc), [gVisor](https://github.com/google/gvisor) and 67 [Kata Containers](https://github.com/kata-containers/kata-containers). 68 69 ![Arch](./docs/arch.svg) 70 71 Also, the judge proxy service such as [Kafka Gateway](https://github.com/apache/kafka) is on the way, which can connect 72 multiple judge runtime services and provides more functionality for users. 73 74 ```protobuf 75 service JudgeService::Runtime { // minimum implementation 76 rpc Handshake(HandshakeRequest) returns (HandshakeResponse); 77 rpc CreateContainer(CreateContainerRequest) returns (google.protobuf.Empty); 78 rpc RemoveContainer(RemoveContainerRequest) returns (google.protobuf.Empty); 79 rpc CopyFile(CopyRequest) returns (google.protobuf.Empty); 80 rpc MakeJudge(MakeJudgeRequest) returns (MakeJudgeResponse); 81 } 82 83 service JudgeService::Compiler { // compiler implementation 84 rpc Handshake(HandshakeRequest) returns (HandshakeResponse); 85 rpc CreateContainer(CreateContainerRequest) returns (google.protobuf.Empty); 86 rpc RemoveContainer(RemoveContainerRequest) returns (google.protobuf.Empty); 87 rpc CopyFile(CopyFileRequest) returns (google.protobuf.Empty); 88 rpc CompileProgram(CompileProgramRequest) returns (google.protobuf.Empty); 89 } 90 91 service JudgeService::Async { // async service implementation 92 JudgeService::Runtime 93 94 rpc QueryJudge(QueryJudgeRequest) returns (QueryJudgeResponse); 95 } 96 service JudgeService::Gateway { // service aggregator 97 JudgeService::Minimum 98 JudgeService::Compiler 99 JudgeService::Async 100 } 101 ``` 102 103 ![Service Flow](./docs/service-flow.svg) 104 105 106