From 194debd877431e1e1f2982edc899588bfa4f0a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herman=20Zvonimir=20Do=C5=A1ilovi=C4=87?= Date: Thu, 7 May 2020 02:11:59 +0200 Subject: [PATCH 01/21] Adapt API for extra languages. --- Dockerfile | 4 +- app/helpers/config.rb | 4 +- app/jobs/isolate_job.rb | 3 +- db/languages/active.rb | 330 +++++---------------------------------- db/languages/archived.rb | 320 ------------------------------------- docs/api/docs.md | 2 +- judge0-api.conf | 4 +- public/docs.html | 4 +- 8 files changed, 54 insertions(+), 617 deletions(-) diff --git a/Dockerfile b/Dockerfile index 717274fd..2cde8341 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM judge0/api-base:1.2.1 AS production +FROM judge0/api-base:1.2.1-extra AS production ENV JUDGE0_HOMEPAGE "https://judge0.com" LABEL homepage=$JUDGE0_HOMEPAGE @@ -38,7 +38,7 @@ COPY . . ENTRYPOINT ["./docker-entrypoint.sh"] CMD ["./scripts/server"] -ENV JUDGE0_VERSION "1.7.1" +ENV JUDGE0_VERSION "1.7.1-extra" LABEL version=$JUDGE0_VERSION diff --git a/app/helpers/config.rb b/app/helpers/config.rb index 010e2d60..6912e4b8 100644 --- a/app/helpers/config.rb +++ b/app/helpers/config.rb @@ -27,8 +27,8 @@ module Config ALLOW_ENABLE_PER_PROCESS_AND_THREAD_TIME_LIMIT = ENV['ALLOW_ENABLE_PER_PROCESS_AND_THREAD_TIME_LIMIT'] != "false" ENABLE_PER_PROCESS_AND_THREAD_MEMORY_LIMIT = ENV['ENABLE_PER_PROCESS_AND_THREAD_MEMORY_LIMIT'] == "true" ALLOW_ENABLE_PER_PROCESS_AND_THREAD_MEMORY_LIMIT = ENV['ALLOW_ENABLE_PER_PROCESS_AND_THREAD_MEMORY_LIMIT'] != "false" - MAX_FILE_SIZE = (ENV['MAX_FILE_SIZE'].presence || 1024).to_i - MAX_MAX_FILE_SIZE = (ENV['MAX_MAX_FILE_SIZE'].presence || 4096).to_i + MAX_FILE_SIZE = (ENV['MAX_FILE_SIZE'].presence || 5120).to_i + MAX_MAX_FILE_SIZE = (ENV['MAX_MAX_FILE_SIZE'].presence || 10240).to_i NUMBER_OF_RUNS = (ENV['NUMBER_OF_RUNS'].presence || 1).to_i MAX_NUMBER_OF_RUNS = (ENV['MAX_NUMBER_OF_RUNS'].presence || 20).to_i REDIRECT_STDERR_TO_STDOUT = ENV['REDIRECT_STDERR_TO_STDOUT'] == "true" diff --git a/app/jobs/isolate_job.rb b/app/jobs/isolate_job.rb index c10b6584..d1b8303c 100644 --- a/app/jobs/isolate_job.rb +++ b/app/jobs/isolate_job.rb @@ -184,7 +184,7 @@ def run command_line_arguments = submission.command_line_arguments.to_s.strip.encode("UTF-8", invalid: :replace).gsub(/[$&;<>|`]/, "") run_script = boxdir + "/" + "run" - File.open(run_script, "w") { |f| f.write("#{submission.language.run_cmd} #{command_line_arguments}")} + File.open(run_script, "w") { |f| f.write("#{submission.language.run_cmd % command_line_arguments}")} command = "isolate #{cgroups} \ -s \ @@ -199,6 +199,7 @@ def run #{submission.enable_per_process_and_thread_time_limit ? (cgroups.present? ? "--no-cg-timing" : "") : "--cg-timing"} \ #{submission.enable_per_process_and_thread_memory_limit ? "-m " : "--cg-mem="}#{submission.memory_limit} \ -f #{submission.max_file_size} \ + --share-net \ -E HOME=#{workdir} \ -E PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\" \ -E LANG -E LANGUAGE -E LC_ALL -E JUDGE0_HOMEPAGE -E JUDGE0_SOURCE_CODE -E JUDGE0_MAINTAINER -E JUDGE0_VERSION \ diff --git a/db/languages/active.rb b/db/languages/active.rb index 2fa050aa..644c781e 100644 --- a/db/languages/active.rb +++ b/db/languages/active.rb @@ -2,325 +2,81 @@ @languages += [ { - id: 43, - name: "Plain Text", - is_archived: false, - source_file: "text.txt", - run_cmd: "/bin/cat text.txt" - }, - { - id: 44, - name: "Executable", - is_archived: false, - source_file: "a.out", - run_cmd: "/bin/chmod +x a.out && ./a.out" - }, - { - id: 45, - name: "Assembly (NASM 2.14.02)", - is_archived: false, - source_file: "main.asm", - compile_cmd: "/usr/local/nasm-2.14.02/bin/nasmld -f elf64 %s main.asm", - run_cmd: "./a.out" - }, - { - id: 46, - name: "Bash (5.0.0)", - is_archived: false, - source_file: "script.sh", - run_cmd: "/usr/local/bash-5.0/bin/bash script.sh" - }, - { - id: 47, - name: "Basic (FBC 1.07.1)", - is_archived: false, - source_file: "main.bas", - compile_cmd: "/usr/local/fbc-1.07.1/bin/fbc %s main.bas", - run_cmd: "./main" - }, - { - id: 48, - name: "C (GCC 7.4.0)", + id: 1, + name: "C (Clang 10.0.1)", is_archived: false, source_file: "main.c", - compile_cmd: "/usr/local/gcc-7.4.0/bin/gcc %s main.c", - run_cmd: "./a.out" - }, - { - id: 49, - name: "C (GCC 8.3.0)", - is_archived: false, - source_file: "main.c", - compile_cmd: "/usr/local/gcc-8.3.0/bin/gcc %s main.c", - run_cmd: "./a.out" - }, - { - id: 50, - name: "C (GCC 9.2.0)", - is_archived: false, - source_file: "main.c", - compile_cmd: "/usr/local/gcc-9.2.0/bin/gcc %s main.c", - run_cmd: "./a.out" - }, - { - id: 51, - name: "C# (Mono 6.6.0.161)", - is_archived: false, - source_file: "Main.cs", - compile_cmd: "/usr/local/mono-6.6.0.161/bin/mcs %s Main.cs", - run_cmd: "/usr/local/mono-6.6.0.161/bin/mono Main.exe" + compile_cmd: "/usr/bin/clang-10 %s main.c", + run_cmd: "./a.out %s" }, { - id: 52, - name: "C++ (GCC 7.4.0)", + id: 2, + name: "C++ (Clang 10.0.1)", is_archived: false, source_file: "main.cpp", - compile_cmd: "/usr/local/gcc-7.4.0/bin/g++ %s main.cpp", - run_cmd: "LD_LIBRARY_PATH=/usr/local/gcc-7.4.0/lib64 ./a.out" - }, - { - id: 53, - name: "C++ (GCC 8.3.0)", - is_archived: false, - source_file: "main.cpp", - compile_cmd: "/usr/local/gcc-8.3.0/bin/g++ %s main.cpp", - run_cmd: "LD_LIBRARY_PATH=/usr/local/gcc-8.3.0/lib64 ./a.out" - }, - { - id: 54, - name: "C++ (GCC 9.2.0)", - is_archived: false, - source_file: "main.cpp", - compile_cmd: "/usr/local/gcc-9.2.0/bin/g++ %s main.cpp", - run_cmd: "LD_LIBRARY_PATH=/usr/local/gcc-9.2.0/lib64 ./a.out" - }, - { - id: 55, - name: "Common Lisp (SBCL 2.0.0)", - is_archived: false, - source_file: "script.lisp", - run_cmd: "SBCL_HOME=/usr/local/sbcl-2.0.0/lib/sbcl /usr/local/sbcl-2.0.0/bin/sbcl --script script.lisp" - }, - { - id: 56, - name: "D (DMD 2.089.1)", - is_archived: false, - source_file: "main.d", - compile_cmd: "/usr/local/d-2.089.1/linux/bin64/dmd %s main.d", - run_cmd: "./main" - }, - { - id: 57, - name: "Elixir (1.9.4)", - is_archived: false, - source_file: "script.exs", - run_cmd: "/usr/local/elixir-1.9.4/bin/elixir script.exs" - }, - { - id: 58, - name: "Erlang (OTP 22.2)", - is_archived: false, - source_file: "main.erl", - run_cmd: "/bin/sed -i '1s/^/\\n/' main.erl && /usr/local/erlang-22.2/bin/escript main.erl" - }, - { - id: 59, - name: "Fortran (GFortran 9.2.0)", - is_archived: false, - source_file: "main.f90", - compile_cmd: "/usr/local/gcc-9.2.0/bin/gfortran %s main.f90", - run_cmd: "LD_LIBRARY_PATH=/usr/local/gcc-9.2.0/lib64 ./a.out" - }, - { - id: 60, - name: "Go (1.13.5)", - is_archived: false, - source_file: "main.go", - compile_cmd: "GOCACHE=/tmp/.cache/go-build /usr/local/go-1.13.5/bin/go build %s main.go", - run_cmd: "./main" + compile_cmd: "/usr/bin/clang++-10 %s main.cpp", + run_cmd: "./a.out %s" }, { - id: 61, - name: "Haskell (GHC 8.8.1)", + id: 3, + name: "C3 (latest)", is_archived: false, - source_file: "main.hs", - compile_cmd: "/usr/local/ghc-8.8.1/bin/ghc %s main.hs", - run_cmd: "./main" + source_file: "main.c3", + compile_cmd: "/usr/local/c3/c3c %s compile main.c3; /usr/bin/clang-10 main.o", + run_cmd: "./a.out %s" }, { - id: 62, - name: "Java (OpenJDK 13.0.1)", + id: 4, + name: "Java (OpenJDK 14.0.1)", is_archived: false, source_file: "Main.java", - compile_cmd: "/usr/local/openjdk13/bin/javac %s Main.java", - run_cmd: "/usr/local/openjdk13/bin/java Main" + compile_cmd: "/usr/local/openjdk14/bin/javac %s Main.java", + run_cmd: "/usr/local/openjdk14/bin/java Main %s" }, { - id: 63, - name: "JavaScript (Node.js 12.14.0)", + id: 5, + name: "Java Test (OpenJDK 14.0.1, JUnit Platform Console Standalone 1.6.2)", is_archived: false, - source_file: "script.js", - run_cmd: "/usr/local/node-12.14.0/bin/node script.js" + source_file: "MainTest.java", + compile_cmd: "/usr/local/openjdk14/bin/javac -cp /usr/local/junit-platform-console-standalone-1.6.2/launcher.jar %s MainTest.java", + run_cmd: "/usr/local/openjdk14/bin/java -jar /usr/local/junit-platform-console-standalone-1.6.2/launcher.jar --disable-ansi-colors --disable-banner -cp . -c MainTest %s" }, { - id: 64, - name: "Lua (5.3.5)", - is_archived: false, - source_file: "script.lua", - compile_cmd: "/usr/local/lua-5.3.5/luac53 %s script.lua", - run_cmd: "/usr/local/lua-5.3.5/lua53 ./luac.out" - }, - { - id: 65, - name: "OCaml (4.09.0)", - is_archived: false, - source_file: "main.ml", - compile_cmd: "/usr/local/ocaml-4.09.0/bin/ocamlc %s main.ml", - run_cmd: "./a.out" - }, - { - id: 66, - name: "Octave (5.1.0)", - is_archived: false, - source_file: "script.m", - run_cmd: "/usr/local/octave-5.1.0/bin/octave-cli -q --no-gui --no-history script.m" - }, - { - id: 67, - name: "Pascal (FPC 3.0.4)", - is_archived: false, - source_file: "main.pas", - compile_cmd: "/usr/local/fpc-3.0.4/bin/fpc %s main.pas", - run_cmd: "./main" - }, - { - id: 68, - name: "PHP (7.4.1)", - is_archived: false, - source_file: "script.php", - run_cmd: "/usr/local/php-7.4.1/bin/php script.php" - }, - { - id: 69, - name: "Prolog (GNU Prolog 1.4.5)", - is_archived: false, - source_file: "main.pro", - compile_cmd: "PATH=\"/usr/local/gprolog-1.4.5/gprolog-1.4.5/bin:$PATH\" /usr/local/gprolog-1.4.5/gprolog-1.4.5/bin/gplc --no-top-level %s main.pro", - run_cmd: "./main" - }, - { - id: 70, - name: "Python (2.7.17)", - is_archived: false, - source_file: "script.py", - run_cmd: "/usr/local/python-2.7.17/bin/python2 script.py" - }, - { - id: 71, - name: "Python (3.8.1)", - is_archived: false, - source_file: "script.py", - run_cmd: "/usr/local/python-3.8.1/bin/python3 script.py" - }, - { - id: 72, - name: "Ruby (2.7.0)", - is_archived: false, - source_file: "script.rb", - run_cmd: "/usr/local/ruby-2.7.0/bin/ruby script.rb" - }, - { - id: 73, - name: "Rust (1.40.0)", - is_archived: false, - source_file: "main.rs", - compile_cmd: "/usr/local/rust-1.40.0/bin/rustc %s main.rs", - run_cmd: "./main" - }, - { - id: 74, - name: "TypeScript (3.7.4)", - is_archived: false, - source_file: "script.ts", - compile_cmd: "/usr/bin/tsc %s script.ts", - run_cmd: "/usr/local/node-12.14.0/bin/node script.js" - }, - { - id: 75, - name: "C (Clang 7.0.1)", + id: 6, + name: "MPI (OpenRTE 3.1.3) with C (GCC 8.3.0)", is_archived: false, source_file: "main.c", - compile_cmd: "/usr/bin/clang-7 %s main.c", - run_cmd: "./a.out" + compile_cmd: "/usr/bin/mpicc %s main.c", + run_cmd: "/usr/bin/mpiexec --allow-run-as-root --oversubscribe %s ./a.out" }, { - id: 76, - name: "C++ (Clang 7.0.1)", + id: 7, + name: "MPI (OpenRTE 3.1.3) with C++ (GCC 8.3.0)", is_archived: false, source_file: "main.cpp", - compile_cmd: "/usr/bin/clang++-7 %s main.cpp", - run_cmd: "./a.out" - }, - { - id: 77, - name: "COBOL (GnuCOBOL 2.2)", - is_archived: false, - source_file: "main.cob", - compile_cmd: "/usr/local/gnucobol-2.2/bin/cobc -free -x %s main.cob", - run_cmd: "LD_LIBRARY_PATH=/usr/local/gnucobol-2.2/lib ./main" - }, - { - id: 78, - name: "Kotlin (1.3.70)", - is_archived: false, - source_file: "Main.kt", - compile_cmd: "/usr/local/kotlin-1.3.70/bin/kotlinc %s Main.kt", - run_cmd: "/usr/local/kotlin-1.3.70/bin/kotlin MainKt" + compile_cmd: "/usr/bin/mpicxx %s main.cpp", + run_cmd: "/usr/bin/mpiexec --allow-run-as-root --oversubscribe %s ./a.out" }, { - id: 79, - name: "Objective-C (Clang 7.0.1)", + id: 8, + name: "MPI (OpenRTE 3.1.3) with Python (3.7.3)", is_archived: false, - source_file: "main.m", - compile_cmd: "/usr/bin/clang-7 `gnustep-config --objc-flags | sed 's/-W[^ ]* //g'` `gnustep-config --base-libs | sed 's/-shared-libgcc//'` -I/usr/lib/gcc/x86_64-linux-gnu/8/include main.m %s", - run_cmd: "./a.out" - }, - { - id: 80, - name: "R (4.0.0)", - is_archived: false, - source_file: "script.r", - run_cmd: "/usr/local/r-4.0.0/bin/Rscript script.r" - }, - { - id: 81, - name: "Scala (2.13.2)", - is_archived: false, - source_file: "Main.scala", - compile_cmd: "/usr/local/scala-2.13.2/bin/scalac %s Main.scala", - run_cmd: "/usr/local/scala-2.13.2/bin/scala Main" - }, - { - id: 82, - name: "SQL (SQLite 3.27.2)", - is_archived: false, - source_file: "script.sql", - run_cmd: "/bin/cat script.sql | /usr/bin/sqlite3 db.sqlite" + source_file: "script.py", + run_cmd: "/usr/bin/mpiexec --allow-run-as-root --oversubscribe %s /usr/bin/python3 script.py" }, { - id: 83, - name: "Swift (5.2.3)", + id: 9, + name: "Nim (stable)", is_archived: false, - source_file: "Main.swift", - compile_cmd: "/usr/local/swift-5.2.3/bin/swiftc %s Main.swift", - run_cmd: "./Main" + source_file: "main.nim", + compile_cmd: "/usr/local/nim/bin/nim compile --nimcache:.cache/nim %s main.nim", + run_cmd: "./main %s" }, { - id: 84, - name: "Visual Basic.Net (vbnc 0.0.0.5943)", + id: 10, + name: "Python for ML (3.7.3)", is_archived: false, - source_file: "Main.vb", - compile_cmd: "/usr/bin/vbnc %s Main.vb", - run_cmd: "/usr/bin/mono Main.exe" + source_file: "script.py", + run_cmd: "/usr/bin/python3 script.py %s" } ] \ No newline at end of file diff --git a/db/languages/archived.rb b/db/languages/archived.rb index baaaf7e2..fbec8aed 100644 --- a/db/languages/archived.rb +++ b/db/languages/archived.rb @@ -1,324 +1,4 @@ @languages ||= [] @languages += [ - { - id: 1, - name: "Bash (4.4)", - is_archived: true, - source_file: "script.sh", - run_cmd: "/usr/local/bash-4.4/bin/bash script.sh" - }, - { - id: 2, - name: "Bash (4.0)", - is_archived: true, - source_file: "script.sh", - run_cmd: "/usr/local/bash-4.0/bin/bash script.sh" - }, - { - id: 3, - name: "Basic (fbc 1.05.0)", - is_archived: true, - source_file: "main.bas", - compile_cmd: "/usr/local/fbc-1.05.0/bin/fbc %s main.bas", - run_cmd: "./main" - }, - { - id: 4, - name: "C (gcc 7.2.0)", - is_archived: true, - source_file: "main.c", - compile_cmd: "/usr/local/gcc-7.2.0/bin/gcc %s main.c", - run_cmd: "./a.out" - }, - { - id: 5, - name: "C (gcc 6.4.0)", - is_archived: true, - source_file: "main.c", - compile_cmd: "/usr/local/gcc-6.4.0/bin/gcc %s main.c", - run_cmd: "./a.out" - }, - { - id: 6, - name: "C (gcc 6.3.0)", - is_archived: true, - source_file: "main.c", - compile_cmd: "/usr/local/gcc-6.3.0/bin/gcc %s main.c", - run_cmd: "./a.out" - }, - { - id: 7, - name: "C (gcc 5.4.0)", - is_archived: true, - source_file: "main.c", - compile_cmd: "/usr/local/gcc-5.4.0/bin/gcc %s main.c", - run_cmd: "./a.out" - }, - { - id: 8, - name: "C (gcc 4.9.4)", - is_archived: true, - source_file: "main.c", - compile_cmd: "/usr/local/gcc-4.9.4/bin/gcc %s main.c", - run_cmd: "./a.out" - }, - { - id: 9, - name: "C (gcc 4.8.5)", - is_archived: true, - source_file: "main.c", - compile_cmd: "/usr/local/gcc-4.8.5/bin/gcc %s main.c", - run_cmd: "./a.out" - }, - - { - id: 10, - name: "C++ (g++ 7.2.0)", - is_archived: true, - source_file: "main.cpp", - compile_cmd: "/usr/local/gcc-7.2.0/bin/g++ %s main.cpp", - run_cmd: "LD_LIBRARY_PATH=/usr/local/gcc-7.2.0/lib64 ./a.out" - }, - { - id: 11, - name: "C++ (g++ 6.4.0)", - is_archived: true, - source_file: "main.cpp", - compile_cmd: "/usr/local/gcc-6.4.0/bin/g++ %s main.cpp", - run_cmd: "LD_LIBRARY_PATH=/usr/local/gcc-6.4.0/lib64 ./a.out" - }, - { - id: 12, - name: "C++ (g++ 6.3.0)", - is_archived: true, - source_file: "main.cpp", - compile_cmd: "/usr/local/gcc-6.3.0/bin/g++ %s main.cpp", - run_cmd: "LD_LIBRARY_PATH=/usr/local/gcc-6.3.0/lib64 ./a.out" - }, - { - id: 13, - name: "C++ (g++ 5.4.0)", - is_archived: true, - source_file: "main.cpp", - compile_cmd: "/usr/local/gcc-5.4.0/bin/g++ %s main.cpp", - run_cmd: "LD_LIBRARY_PATH=/usr/local/gcc-5.4.0/lib64 ./a.out" - }, - { - id: 14, - name: "C++ (g++ 4.9.4)", - is_archived: true, - source_file: "main.cpp", - compile_cmd: "/usr/local/gcc-4.9.4/bin/g++ %s main.cpp", - run_cmd: "LD_LIBRARY_PATH=/usr/local/gcc-4.9.4/lib64 ./a.out" - }, - { - id: 15, - name: "C++ (g++ 4.8.5)", - is_archived: true, - source_file: "main.cpp", - compile_cmd: "/usr/local/gcc-4.8.5/bin/g++ %s main.cpp", - run_cmd: "LD_LIBRARY_PATH=/usr/local/gcc-4.8.5/lib64 ./a.out" - }, - { - id: 16, - name: "C# (mono 5.4.0.167)", - is_archived: true, - source_file: "Main.cs", - compile_cmd: "/usr/local/mono-5.4.0.167/bin/mcs %s Main.cs", - run_cmd: "/usr/local/mono-5.4.0.167/bin/mono Main.exe" - }, - { - id: 17, - name: "C# (mono 5.2.0.224)", - is_archived: true, - source_file: "Main.cs", - compile_cmd: "/usr/local/mono-5.2.0.224/bin/mcs %s Main.cs", - run_cmd: "/usr/local/mono-5.2.0.224/bin/mono Main.exe" - }, - { - id: 18, - name: "Clojure (1.8.0)", - is_archived: true, - source_file: "main.clj", - run_cmd: "/usr/bin/java -cp /usr/local/clojure-1.8.0/clojure-1.8.0.jar clojure.main main.clj" - }, - { - id: 19, - name: "Crystal (0.23.1)", - is_archived: true, - source_file: "main.cr", - compile_cmd: "/usr/local/crystal-0.23.1-3/bin/crystal build %s main.cr", - run_cmd: "./main" - }, - { - id: 20, - name: "Elixir (1.5.1)", - is_archived: true, - source_file: "main.exs", - run_cmd: "/usr/local/elixir-1.5.1/bin/elixir main.exs" - }, - { - id: 21, - name: "Erlang (OTP 20.0)", - is_archived: true, - source_file: "main.erl", - run_cmd: "/bin/sed -i \"s/^/\\n/\" main.erl && /usr/local/erlang-20.0/bin/escript main.erl" - }, - { - id: 22, - name: "Go (1.9)", - is_archived: true, - source_file: "main.go", - compile_cmd: "/usr/local/go-1.9/bin/go build %s main.go", - run_cmd: "./main" - }, - { - id: 23, - name: "Haskell (ghc 8.2.1)", - is_archived: true, - source_file: "main.hs", - compile_cmd: "/usr/local/ghc-8.2.1/bin/ghc %s main.hs", - run_cmd: "./main" - }, - { - id: 24, - name: "Haskell (ghc 8.0.2)", - is_archived: true, - source_file: "main.hs", - compile_cmd: "/usr/local/ghc-8.0.2/bin/ghc %s main.hs", - run_cmd: "./main" - }, - { - id: 25, - name: "Insect (5.0.0)", - is_archived: true, - source_file: "main.ins", - run_cmd: "/usr/local/insect-5.0.0/insect main.ins" - }, - { - id: 26, - name: "Java (OpenJDK 9 with Eclipse OpenJ9)", - is_archived: true, - source_file: "Main.java", - compile_cmd: "/usr/local/openjdk9-openj9/bin/javac %s Main.java", - run_cmd: "/usr/local/openjdk9-openj9/bin/java Main" - }, - { - id: 27, - name: "Java (OpenJDK 8)", - is_archived: true, - source_file: "Main.java", - compile_cmd: "/usr/lib/jvm/java-8-openjdk-amd64/bin/javac %s Main.java", - run_cmd: "/usr/lib/jvm/java-8-openjdk-amd64/bin/java Main", - }, - { - id: 28, - name: "Java (OpenJDK 7)", - is_archived: true, - source_file: "Main.java", - compile_cmd: "/usr/lib/jvm/java-7-openjdk-amd64/bin/javac %s Main.java", - run_cmd: "/usr/lib/jvm/java-7-openjdk-amd64/bin/java Main", - }, - { - id: 29, - name: "JavaScript (nodejs 8.5.0)", - is_archived: true, - source_file: "main.js", - run_cmd: "/usr/local/node-8.5.0/bin/node main.js" - }, - { - id: 30, - name: "JavaScript (nodejs 7.10.1)", - is_archived: true, - source_file: "main.js", - run_cmd: "/usr/local/node-7.10.1/bin/node main.js" - }, - { - id: 31, - name: "OCaml (4.05.0)", - is_archived: true, - source_file: "main.ml", - compile_cmd: "/usr/local/ocaml-4.05.0/bin/ocamlc %s main.ml", - run_cmd: "./a.out" - }, - { - id: 32, - name: "Octave (4.2.0)", - is_archived: true, - source_file: "file.m", - run_cmd: "/usr/local/octave-4.2.0/bin/octave-cli -q --no-gui --no-history file.m" - }, - { - id: 33, - name: "Pascal (fpc 3.0.0)", - is_archived: true, - source_file: "main.pas", - compile_cmd: "/usr/local/fpc-3.0.0/bin/fpc %s main.pas", - run_cmd: "./main" - }, - { - id: 34, - name: "Python (3.6.0)", - is_archived: true, - source_file: "main.py", - run_cmd: "/usr/local/python-3.6.0/bin/python3 main.py" - }, - { - id: 35, - name: "Python (3.5.3)", - is_archived: true, - source_file: "main.py", - run_cmd: "/usr/local/python-3.5.3/bin/python3 main.py" - }, - { - id: 36, - name: "Python (2.7.9)", - is_archived: true, - source_file: "main.py", - run_cmd: "/usr/local/python-2.7.9/bin/python main.py" - }, - { - id: 37, - name: "Python (2.6.9)", - is_archived: true, - source_file: "main.py", - run_cmd: "/usr/local/python-2.6.9/bin/python main.py" - }, - { - id: 38, - name: "Ruby (2.4.0)", - is_archived: true, - source_file: "main.rb", - run_cmd: "/usr/local/ruby-2.4.0/bin/ruby main.rb" - }, - { - id: 39, - name: "Ruby (2.3.3)", - is_archived: true, - source_file: "main.rb", - run_cmd: "/usr/local/ruby-2.3.3/bin/ruby main.rb" - }, - { - id: 40, - name: "Ruby (2.2.6)", - is_archived: true, - source_file: "main.rb", - run_cmd: "/usr/local/ruby-2.2.6/bin/ruby main.rb" - }, - { - id: 41, - name: "Ruby (2.1.9)", - is_archived: true, - source_file: "main.rb", - run_cmd: "/usr/local/ruby-2.1.9/bin/ruby main.rb" - }, - { - id: 42, - name: "Rust (1.20.0)", - is_archived: true, - source_file: "main.rs", - compile_cmd: "/usr/local/rust-1.20.0/bin/rustc %s main.rs", - run_cmd: "./main" - } ] \ No newline at end of file diff --git a/docs/api/docs.md b/docs/api/docs.md index 0dc03661..d26c0c5f 100644 --- a/docs/api/docs.md +++ b/docs/api/docs.md @@ -34,7 +34,7 @@ For the production use, consider [deploying your own instance](https://github.co ::: ## Version -This document describes Judge0 API [v1.7.1](https://github.com/judge0/api/tree/v1.7.1). +This document describes Judge0 API [v1.7.1-extra](https://github.com/judge0/api/tree/v1.7.1-extra). ## Date and time formats [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard is used. diff --git a/judge0-api.conf b/judge0-api.conf index e7f2846d..d6ad7c93 100644 --- a/judge0-api.conf +++ b/judge0-api.conf @@ -282,11 +282,11 @@ ENABLE_PER_PROCESS_AND_THREAD_MEMORY_LIMIT= ALLOW_ENABLE_PER_PROCESS_AND_THREAD_MEMORY_LIMIT= # Limit size of files created (or modified) by the program in kilobytes. -# Default: 1024 +# Default: 5120 MAX_FILE_SIZE= # Maximum custom MAX_FILE_SIZE. -# Default: 4096 +# Default: 10240 MAX_MAX_FILE_SIZE= # Run each program this many times and take average of time and memory. diff --git a/public/docs.html b/public/docs.html index bbbcc69b..9ecd8cc9 100644 --- a/public/docs.html +++ b/public/docs.html @@ -49,7 +49,7 @@

Official public API deploying your own instance of the Judge0 API.

Version

-

This document describes Judge0 API v1.7.1.

+

This document describes Judge0 API v1.7.1-extra.

Date and time formats

ISO 8601 standard is used.

Example: 2016-09-11T10:19:35Z

@@ -1653,7 +1653,7 @@

Example URI

GET& }

Version

Version
GET/version

Returns current version.

Example URI

GET https://api.judge0.com/version

Isolate

Isolate
GET/isolate

Returns result of isolate --version.

Example URI

GET https://api.judge0.com/isolate

License

License
GET/license

Returns a license.

-

Example URI

GET https://api.judge0.com/license

Generated by aglio on 06 May 2020

- - @@ -47,11 +28,10 @@

About Judge0 is a robust, scalable, and open-source online code execution system. You can use it to build a wide range of applications that need online code execution features. Some examples include competitive programming platforms, e-learning platforms, candidate assessment and recruitment platforms, online code editors, online IDEs, and many more.

In our research paper Robust and Scalable Online Code Execution System, we present Judge0’s modern modular architecture that can be easily deployed and scaled. We study its design, comment on the various challenges in building such systems, and compare it with other available online code execution systems and online judge systems.

To see Judge0 in action, try Judge0 IDE - our free and open-source online code editor. You can also try using a dummy client that can help you explore and test most of the features of Judge0.

-

Easily integrate online code editor with code execution (a.k.a. online compiler) to your website with our embeddable web widgets.

Features

-

Feel free to start with the FREE Basic Plan on RapidAPI or host it yourself.

+

Feel free to start with the FREE Basic Plan on RapidAPI or host it yourself.

You can find our detailed plans and pricing here.

Why should you use Judge0 on RapidAPI?

Our infrastructure allows you to focus on building your product and forget about the know-how of maintaining and scaling Judge0.

@@ -71,16 +51,14 @@

Get Started

Judge0 comes in two flavors: Judge0 CE and Judge0 Extra CE. They differ mostly in the supported languages.

You can find the source code for Judge0 CE on the master branch, while you can find the source code for Judge0 Extra CE on the extra branch.

-

Judge0 CE is also available on RapidAPI.

+

Judge0 Extra CE is also available on RapidAPI.

Version

-

This document describes Judge0 Extra CE v1.13.0.

+

This document describes Judge0 CE v1.13.1.

Date and time formats

ISO 8601 standard is used.

Example: 2016-09-11T10:19:35Z

License

Judge0 is licensed under the GNU General Public License v3.0.

-

Donate

-

You are more than welcome to support Judge0 development on Patreon, via PayPal or Revolut. Thank you.


Authentication

Administrators of Judge0 can configure Judge0 to require you to have an authentication token (a.k.a. API key). If that is the case with the instance of Judge0 you are using, then you should provide X-Auth-Token header field in every API request.

@@ -103,7 +81,7 @@

Donate

To issue some API calls you need to be authorized. For example, you need to be authorized to @@ -128,7 +106,7 @@

Example URI

POSTAlthough you can send authorization token as URI parameter, always send authorization token through headers.
-

Example URI

POST https://extra-ce.judge0.com/authorize
Request
HideShow
Headers
X-Auth-User: a1133bc6-a0f6-46bf-a2d8-6157418c6fe2
Response  200
HideShow

If your authorization token is valid.

+

Example URI

POST https://ce.judge0.com/authorize
Request
HideShow
Headers
X-Auth-User: a1133bc6-a0f6-46bf-a2d8-6157418c6fe2
Response  200
HideShow

If your authorization token is valid.

Response  401
HideShow

Authentication failed. Please read about authentication process.

Response  403
HideShow

Authorization failed because your authorization token is invalid.

Submissions

Submission

Submission is used for running arbitrary source code in one of @@ -426,7 +404,7 @@

Multi-file programs v1.10.0 and they allow you specify your own compilation and execution scripts that Judge0 will use.

To use multi-file program feature you need to choose a language called Multi-file program whoose ID is 89. Moreover, you need to send all program files with additional_files attribute. With multi-file programs attribute source_code cannot be used, i.e. all files should be sent with additional_files attribute.

As mentioned in the table above, additional_files attribute should be a content of a Base64 encoded .zip archive. This archive will be extracted in the sandbox before compilation and execution.

-

For the Judge0 to know how to compile and execute your multi-file program you need to provide two special files that should be available in the root of the .zip archive that you are sending with additional_files attribute. These files should be named compile and run, and are expected to be Bash scripts that know how to compile and execute your multi-file program. If your multi-file program does not need compilation step, then you don’t need to provide compile script. Take a look at this example to learn how to use this feature to compile and run multi-file C++ project that uses CMake.

+

For the Judge0 to know how to compile and execute your multi-file program you need to provide two special files that should be available in the root of the .zip archive that you are sending with additional_files attribute. These files should be named compile and run, and are expected to be Bash scripts that know how to compile and execute your multi-file program. If your multi-file program does not need compilation step, then you don’t need to provide compile script. Take a look at this example to learn how to use this feature to compile and run multi-file C++ project that uses CMake.

Create a Submission
POST/submissions/{?base64_encoded,wait}

Creates new submission. Created submission waits in queue to be processed. On successful creation, you are returned submission token which can be used to check submission status.

If submission’s source_code, stdin or expected_output contains non printable characters, or @@ -443,7 +421,7 @@

Multi-file programs

GET/submissions/{token}{?base64_encoded,fields}

Returns details about submission.

Just like in create submission you can receive Base64 encoded data for every text type attribute (check the table to see which attributes are text type). By default, this parameter is set to false and Judge0 will send you raw data.

By default Judge0 is sending 8 attributes for submission. By sending fields query parameter you can specify exactly which attributes you want from Judge0. Special value * will return all available attributes.

-

Example URI

GET https://extra-ce.judge0.com/submissions/d85cd024-1548-4165-96c7-7bc88673f194?base64_encoded=false&fields=stdout,stderr,status_id,language_id
URI Parameters
HideShow
token
string (required) Example: d85cd024-1548-4165-96c7-7bc88673f194

Token of submission. You got this token when you created submission.

+

Example URI

GET https://ce.judge0.com/submissions/d85cd024-1548-4165-96c7-7bc88673f194?base64_encoded=false&fields=stdout,stderr,status_id,language_id
URI Parameters
HideShow
token
string (required) Example: d85cd024-1548-4165-96c7-7bc88673f194

Token of submission. You got this token when you created submission.

base64_encoded
boolean (optional) Example: false

Set to true if you want to receive Base64 encoded data from Judge0. You should set this to true if you expect the program’s stdout to contain non-printable characters or if you expect the compiler to output non-printable characters during a compile error (GCC does this, for instance).

fields
string (optional) Default: stdout,time,memory,stderr,token,compile_output,message,status Example: stdout,stderr,status_id,language_id

Return only the desired attributes.

Response  200
HideShow
Headers
Content-Type: applicatiion/json
Body
{
@@ -564,7 +542,7 @@ 

Example URI

GET& }
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
   "error": "some attributes for this submission cannot be converted to UTF-8, use base64_encoded=true query parameter"
 }
Response  401
HideShow

Authentication failed. Please read about authentication process.

-

Get Submissions
GET/submissions/{?base64_encoded,fields,page,per_page}

Example URI

GET https://extra-ce.judge0.com/submissions/?base64_encoded=false&fields=status,language,time&page=4&per_page=2
URI Parameters
HideShow
base64_encoded
boolean (optional) Default: false Example: false

Set to true if you want to receive Base64 encoded data from Judge0.

+

Get Submissions
GET/submissions/{?base64_encoded,fields,page,per_page}

Example URI

GET https://ce.judge0.com/submissions/?base64_encoded=false&fields=status,language,time&page=4&per_page=2
URI Parameters
HideShow
base64_encoded
boolean (optional) Default: false Example: false

Set to true if you want to receive Base64 encoded data from Judge0.

page
integer (optional) Default: 1 Example: 4

Pagination page number.

per_page
integer (optional) Default: 20 Example: 2

Number of submissions to return per page.

fields
string (optional) Default: stdout,time,memory,stderr,token,compile_output,message,status Example: status,language,time

Return only the desired attributes.

@@ -653,7 +631,7 @@

Example URI

GET& you are using disallowed submission deletion. So before using this feature please check configuration of Judge0 you are using.

For this request query parameter base64_encoded is implicitly set to true and cannot be changed. This guarantees you will successfully get requested submission attributes after deletion.

-

Example URI

DELETE https://extra-ce.judge0.com/submissions/d85cd024-1548-4165-96c7-7bc88673f194?fields=stdout,stderr,status_id,language_id
URI Parameters
HideShow
token
string (required) Example: d85cd024-1548-4165-96c7-7bc88673f194

Token of submission. You got this token when you created submission.

+

Example URI

DELETE https://ce.judge0.com/submissions/d85cd024-1548-4165-96c7-7bc88673f194?fields=stdout,stderr,status_id,language_id
URI Parameters
HideShow
token
string (required) Example: d85cd024-1548-4165-96c7-7bc88673f194

Token of submission. You got this token when you created submission.

fields
string (optional) Default: stdout,time,memory,stderr,token,compile_output,message,status Example: stdout,stderr,status_id,language_id

Return only the desired attributes.

Response  200
HideShow
Headers
Content-Type: applcation/json
Body
{
   "stdout": "aGVsbG8sIHdvcmxkCg==\n",
@@ -673,7 +651,7 @@ 

Example URI

DELETE}
Response  401
HideShow

Authentication failed. Please read about authentication process.

Response  403
HideShow

Authorization failed. Please read about authorization process.

Submission Batch

Create a Submission Batch
POST/submissions/batch{?base64_encoded}

Create multiple submissions at once.

-

Example URI

POST https://extra-ce.judge0.com/submissions/batch?base64_encoded=false
URI Parameters
HideShow
base64_encoded
boolean (optional) Default: false Example: false

Set to true if you are sending Base64 encoded data.

+

Example URI

POST https://ce.judge0.com/submissions/batch?base64_encoded=false
URI Parameters
HideShow
base64_encoded
boolean (optional) Default: false Example: false

Set to true if you are sending Base64 encoded data.

Request
HideShow
Headers
Content-Type: application/json
Body
{
   "submissions": [
     {
@@ -729,7 +707,7 @@ 

Example URI

POST} ]

Get a Submission Batch
GET/submissions/batch{?tokens,base64_encoded,fields}

Get multiple submissions at once.

-

Example URI

GET https://extra-ce.judge0.com/submissions/batch?tokens=db54881d-bcf5-4c7b-a2e3-d33fe7e25de7,ecc52a9b-ea80-4a00-ad50-4ab6cc3bb2a1,1b35ec3b-5776-48ef-b646-d5522bdeb2cc&base64_encoded=false&fields=token,stdout,stderr,status_id,language_id
URI Parameters
HideShow
tokens
string (required) Example: db54881d-bcf5-4c7b-a2e3-d33fe7e25de7,ecc52a9b-ea80-4a00-ad50-4ab6cc3bb2a1,1b35ec3b-5776-48ef-b646-d5522bdeb2cc

Submission tokens separeted with ,.

+

Example URI

GET https://ce.judge0.com/submissions/batch?tokens=db54881d-bcf5-4c7b-a2e3-d33fe7e25de7,ecc52a9b-ea80-4a00-ad50-4ab6cc3bb2a1,1b35ec3b-5776-48ef-b646-d5522bdeb2cc&base64_encoded=false&fields=token,stdout,stderr,status_id,language_id
URI Parameters
HideShow
tokens
string (required) Example: db54881d-bcf5-4c7b-a2e3-d33fe7e25de7,ecc52a9b-ea80-4a00-ad50-4ab6cc3bb2a1,1b35ec3b-5776-48ef-b646-d5522bdeb2cc

Submission tokens separeted with ,.

base64_encoded
boolean (optional) Default: false Example: false

Set to true if you want to receive Base64 encoded data.

fields
string (optional) Default: stdout,time,memory,stderr,token,compile_output,message,status Example: token,stdout,stderr,status_id,language_id

Return only the desired attributes.

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
@@ -757,7 +735,7 @@ 

Example URI

GET& } ] }

Statuses and Languages

Language

Get Languages
GET/languages/

Get active languages.

-

Example URI

GET https://extra-ce.judge0.com/languages/
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
+

Example URI

GET https://ce.judge0.com/languages/
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
   {
     "id": 45,
     "name": "Assembly (NASM 2.14.02)"
@@ -886,7 +864,7 @@ 

Example URI

GET& "id": 74, "name": "TypeScript (3.7.4)" } -]

Get a Language
GET/languages/{id}

Example URI

GET https://extra-ce.judge0.com/languages/1
URI Parameters
HideShow
id
integer (required) Example: 1

Language ID.

+]

Get a Language
GET/languages/{id}

Example URI

GET https://ce.judge0.com/languages/1
URI Parameters
HideShow
id
integer (required) Example: 1

Language ID.

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
   "id": 1,
   "name": "Bash (4.4)",
@@ -895,7 +873,7 @@ 

Example URI

GET& "compile_cmd": null, "run_cmd": "/usr/local/bash-4.4/bin/bash script.sh" }

Active and Archived Languages

Get Active and Archived Languages
GET/languages/all

Get active and archived languages.

-

Example URI

GET https://extra-ce.judge0.com/languages/all
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
+

Example URI

GET https://ce.judge0.com/languages/all
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
   {
     "id": 45,
     "name": "Assembly (NASM 2.14.02)",
@@ -1266,7 +1244,7 @@ 

Example URI

GET& "name": "TypeScript (3.7.4)", "is_archived": false } -]

Status

Get Statuses
GET/statuses

Example URI

GET https://extra-ce.judge0.com/statuses
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
+]

Status

Get Statuses
GET/statuses

Example URI

GET https://ce.judge0.com/statuses
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
   {
     "id": 1,
     "description": "In Queue"
@@ -1338,7 +1316,7 @@ 

Example URI

GET& different hosts with different system configurations. Result of this API request is always from web system. This means that this request might be irrelevant to you if you as user don’t know if web and worker are hosted on the same machine. To find that out, please contact admins who host Judge0 you are using.

-

Example URI

GET https://extra-ce.judge0.com/system_info
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
+

Example URI

GET https://ce.judge0.com/system_info
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
   "Architecture": "x86_64",
   "CPU op-mode(s)": "32-bit, 64-bit",
   "Byte Order": "Little Endian",
@@ -1634,7 +1612,7 @@ 

Example URI

GET&

For example, max_cpu_time_limit with value 20 means that user cannot create new submission which has cpu_time_limit greater than 20.

-

Example URI

GET https://extra-ce.judge0.com/config_info
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
+

Example URI

GET https://ce.judge0.com/config_info
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
   "enable_wait_result": true,
   "enable_compiler_options": true,
   "allowed_languages_for_compile_options": [],
@@ -1662,7 +1640,7 @@ 

Example URI

GET& "number_of_runs": 1, "max_number_of_runs": 20 }

Statistics

Statistics

Statistics
GET/statistics

Get some statistics from current instance. Result is cached for 10 minutes.

-

Example URI

GET https://extra-ce.judge0.com/statistics
URI Parameters
HideShow
invalidate_cache
boolean (optional) Example: false

Set to true if you want to invalidate current cache and fetch new statistics.

+

Example URI

GET https://ce.judge0.com/statistics
URI Parameters
HideShow
invalidate_cache
boolean (optional) Example: false

Set to true if you want to invalidate current cache and fetch new statistics.

Health Check

Workers

Workers
GET/workers

For each queue you will get:

  • @@ -1687,7 +1665,7 @@

    Example URI

    GET&

    how many jobs failed

-

Example URI

GET https://extra-ce.judge0.com/workers
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
+

Example URI

GET https://ce.judge0.com/workers
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
   {
     "queue": "default",
     "size": 0,
@@ -1698,15 +1676,15 @@ 

Example URI

GET& "failed": 0 } ]

Information

About

About
GET/about

Returns general information.

-

Example URI

GET https://extra-ce.judge0.com/about
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
+

Example URI

GET https://ce.judge0.com/about
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
   "version": "1.5.0",
   "homepage": "https://judge0.com",
   "source_code": "https://github.com/judge0/judge0",
   "maintainer": "Herman Zvonimir Došilović <hermanz.dosilovic@gmail.com>"
 }

Version

Version
GET/version

Returns current version.

-

Example URI

GET https://extra-ce.judge0.com/version

Isolate

Isolate
GET/isolate

Returns result of isolate --version.

-

Example URI

GET https://extra-ce.judge0.com/isolate

License

License
GET/license

Returns a license.

-

Example URI

GET https://extra-ce.judge0.com/license

Generated by aglio on 09 Mar 2021

\ No newline at end of file + From 0986c423f9341f173ff4590af174122293e5215c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herman=20Zvonimir=20Do=C5=A1ilovi=C4=87?= Date: Wed, 17 Apr 2024 21:49:19 +0000 Subject: [PATCH 16/21] Update Compose files --- docs/api/hostname.html | 19 ------------------- scripts/dev/shell | 2 +- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/docs/api/hostname.html b/docs/api/hostname.html index caf83f6d..1141d82c 100644 --- a/docs/api/hostname.html +++ b/docs/api/hostname.html @@ -1,21 +1,2 @@ - - diff --git a/scripts/dev/shell b/scripts/dev/shell index 16b1f130..95e2f3f4 100755 --- a/scripts/dev/shell +++ b/scripts/dev/shell @@ -6,4 +6,4 @@ # Usage: ./scripts/dev/shell # docker-compose -f docker-compose.dev.yml up -d -docker-compose -f docker-compose.dev.yml exec --privileged server bash +docker-compose -f docker-compose.dev.yml exec --privileged judge0 bash From 4249dcac641c00956a0f419f008e3c50dd6940ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herman=20Zvonimir=20Do=C5=A1ilovi=C4=87?= Date: Wed, 17 Apr 2024 22:35:55 +0000 Subject: [PATCH 17/21] Update Dockerfile and docs --- Dockerfile | 2 +- public/docs.html | 50 ++++++++++++++++++++++++------------------------ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Dockerfile b/Dockerfile index cce09070..7668f7be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,7 +50,7 @@ LABEL version=$JUDGE0_VERSION FROM production AS development -RUN sudo apt-get update && \ +RUN sudo apt-get update -o Acquire::Check-Valid-Until=false && \ sudo apt-get install -y --no-install-recommends \ vim diff --git a/public/docs.html b/public/docs.html index 312650f7..e5222c37 100644 --- a/public/docs.html +++ b/public/docs.html @@ -1,4 +1,4 @@ -Judge0 CE - API Docs Back to top

Judge0 CE - API Docs

@@ -25,7 +25,7 @@ title.style.color = "white";

About

-

Judge0 is a robust, scalable, and open-source online code execution system. You can use it to build a wide range of applications that need online code execution features. Some examples include competitive programming platforms, e-learning platforms, candidate assessment and recruitment platforms, online code editors, online IDEs, and many more.

+

Judge0 is a robust, scalable, and open-source online code execution system. You can use it to build a wide range of applications that need online code execution features. Some examples include competitive programming platforms, e-learning platforms, candidate assessment and recruitment platforms, online code editors, online IDEs, and many more.

In our research paper Robust and Scalable Online Code Execution System, we present Judge0’s modern modular architecture that can be easily deployed and scaled. We study its design, comment on the various challenges in building such systems, and compare it with other available online code execution systems and online judge systems.

To see Judge0 in action, try Judge0 IDE - our free and open-source online code editor. You can also try using a dummy client that can help you explore and test most of the features of Judge0.

Features

@@ -42,7 +42,7 @@

Features

-

Feel free to start with the FREE Basic Plan on RapidAPI or host it yourself.

+

Feel free to start with the FREE Basic Plan on RapidAPI or host it yourself.

You can find our detailed plans and pricing here.

Why should you use Judge0 on RapidAPI?

Our infrastructure allows you to focus on building your product and forget about the know-how of maintaining and scaling Judge0.

@@ -53,7 +53,7 @@

Flavors master branch, while you can find the source code for Judge0 Extra CE on the extra branch.

Judge0 Extra CE is also available on RapidAPI.

Version

-

This document describes Judge0 CE v1.13.1.

+

This document describes Judge0 CE v1.13.1-extra.

Date and time formats

ISO 8601 standard is used.

Example: 2016-09-11T10:19:35Z

@@ -81,7 +81,7 @@

License

To issue some API calls you need to be authorized. For example, you need to be authorized to @@ -106,7 +106,7 @@

Example URI

POSTAlthough you can send authorization token as URI parameter, always send authorization token through headers.
-

Example URI

POST https://ce.judge0.com/authorize
Request
HideShow
Headers
X-Auth-User: a1133bc6-a0f6-46bf-a2d8-6157418c6fe2
Response  200
HideShow

If your authorization token is valid.

+

Example URI

POST https://extra-ce.judge0.com/authorize
Request
HideShow
Headers
X-Auth-User: a1133bc6-a0f6-46bf-a2d8-6157418c6fe2
Response  200
HideShow

If your authorization token is valid.

Response  401
HideShow

Authentication failed. Please read about authentication process.

Response  403
HideShow

Authorization failed because your authorization token is invalid.

Submissions

Submission

Submission is used for running arbitrary source code in one of @@ -421,7 +421,7 @@

Multi-file programs

GET/submissions/{token}{?base64_encoded,fields}

Returns details about submission.

Just like in create submission you can receive Base64 encoded data for every text type attribute (check the table to see which attributes are text type). By default, this parameter is set to false and Judge0 will send you raw data.

By default Judge0 is sending 8 attributes for submission. By sending fields query parameter you can specify exactly which attributes you want from Judge0. Special value * will return all available attributes.

-

Example URI

GET https://ce.judge0.com/submissions/d85cd024-1548-4165-96c7-7bc88673f194?base64_encoded=false&fields=stdout,stderr,status_id,language_id
URI Parameters
HideShow
token
string (required) Example: d85cd024-1548-4165-96c7-7bc88673f194

Token of submission. You got this token when you created submission.

+

Example URI

GET https://extra-ce.judge0.com/submissions/d85cd024-1548-4165-96c7-7bc88673f194?base64_encoded=false&fields=stdout,stderr,status_id,language_id
URI Parameters
HideShow
token
string (required) Example: d85cd024-1548-4165-96c7-7bc88673f194

Token of submission. You got this token when you created submission.

base64_encoded
boolean (optional) Example: false

Set to true if you want to receive Base64 encoded data from Judge0. You should set this to true if you expect the program’s stdout to contain non-printable characters or if you expect the compiler to output non-printable characters during a compile error (GCC does this, for instance).

fields
string (optional) Default: stdout,time,memory,stderr,token,compile_output,message,status Example: stdout,stderr,status_id,language_id

Return only the desired attributes.

Response  200
HideShow
Headers
Content-Type: applicatiion/json
Body
{
@@ -542,7 +542,7 @@ 

Example URI

GET& }
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
   "error": "some attributes for this submission cannot be converted to UTF-8, use base64_encoded=true query parameter"
 }
Response  401
HideShow

Authentication failed. Please read about authentication process.

-

Get Submissions
GET/submissions/{?base64_encoded,fields,page,per_page}

Example URI

GET https://ce.judge0.com/submissions/?base64_encoded=false&fields=status,language,time&page=4&per_page=2
URI Parameters
HideShow
base64_encoded
boolean (optional) Default: false Example: false

Set to true if you want to receive Base64 encoded data from Judge0.

+

Get Submissions
GET/submissions/{?base64_encoded,fields,page,per_page}

Example URI

GET https://extra-ce.judge0.com/submissions/?base64_encoded=false&fields=status,language,time&page=4&per_page=2
URI Parameters
HideShow
base64_encoded
boolean (optional) Default: false Example: false

Set to true if you want to receive Base64 encoded data from Judge0.

page
integer (optional) Default: 1 Example: 4

Pagination page number.

per_page
integer (optional) Default: 20 Example: 2

Number of submissions to return per page.

fields
string (optional) Default: stdout,time,memory,stderr,token,compile_output,message,status Example: status,language,time

Return only the desired attributes.

@@ -631,7 +631,7 @@

Example URI

GET& you are using disallowed submission deletion. So before using this feature please check configuration of Judge0 you are using.

For this request query parameter base64_encoded is implicitly set to true and cannot be changed. This guarantees you will successfully get requested submission attributes after deletion.

-

Example URI

DELETE https://ce.judge0.com/submissions/d85cd024-1548-4165-96c7-7bc88673f194?fields=stdout,stderr,status_id,language_id
URI Parameters
HideShow
token
string (required) Example: d85cd024-1548-4165-96c7-7bc88673f194

Token of submission. You got this token when you created submission.

+

Example URI

DELETE https://extra-ce.judge0.com/submissions/d85cd024-1548-4165-96c7-7bc88673f194?fields=stdout,stderr,status_id,language_id
URI Parameters
HideShow
token
string (required) Example: d85cd024-1548-4165-96c7-7bc88673f194

Token of submission. You got this token when you created submission.

fields
string (optional) Default: stdout,time,memory,stderr,token,compile_output,message,status Example: stdout,stderr,status_id,language_id

Return only the desired attributes.

Response  200
HideShow
Headers
Content-Type: applcation/json
Body
{
   "stdout": "aGVsbG8sIHdvcmxkCg==\n",
@@ -651,7 +651,7 @@ 

Example URI

DELETE}
Response  401
HideShow

Authentication failed. Please read about authentication process.

Response  403
HideShow

Authorization failed. Please read about authorization process.

Submission Batch

Create a Submission Batch
POST/submissions/batch{?base64_encoded}

Create multiple submissions at once.

-

Example URI

POST https://ce.judge0.com/submissions/batch?base64_encoded=false
URI Parameters
HideShow
base64_encoded
boolean (optional) Default: false Example: false

Set to true if you are sending Base64 encoded data.

+

Example URI

POST https://extra-ce.judge0.com/submissions/batch?base64_encoded=false
URI Parameters
HideShow
base64_encoded
boolean (optional) Default: false Example: false

Set to true if you are sending Base64 encoded data.

Request
HideShow
Headers
Content-Type: application/json
Body
{
   "submissions": [
     {
@@ -707,7 +707,7 @@ 

Example URI

POST} ]

Get a Submission Batch
GET/submissions/batch{?tokens,base64_encoded,fields}

Get multiple submissions at once.

-

Example URI

GET https://ce.judge0.com/submissions/batch?tokens=db54881d-bcf5-4c7b-a2e3-d33fe7e25de7,ecc52a9b-ea80-4a00-ad50-4ab6cc3bb2a1,1b35ec3b-5776-48ef-b646-d5522bdeb2cc&base64_encoded=false&fields=token,stdout,stderr,status_id,language_id
URI Parameters
HideShow
tokens
string (required) Example: db54881d-bcf5-4c7b-a2e3-d33fe7e25de7,ecc52a9b-ea80-4a00-ad50-4ab6cc3bb2a1,1b35ec3b-5776-48ef-b646-d5522bdeb2cc

Submission tokens separeted with ,.

+

Example URI

GET https://extra-ce.judge0.com/submissions/batch?tokens=db54881d-bcf5-4c7b-a2e3-d33fe7e25de7,ecc52a9b-ea80-4a00-ad50-4ab6cc3bb2a1,1b35ec3b-5776-48ef-b646-d5522bdeb2cc&base64_encoded=false&fields=token,stdout,stderr,status_id,language_id
URI Parameters
HideShow
tokens
string (required) Example: db54881d-bcf5-4c7b-a2e3-d33fe7e25de7,ecc52a9b-ea80-4a00-ad50-4ab6cc3bb2a1,1b35ec3b-5776-48ef-b646-d5522bdeb2cc

Submission tokens separeted with ,.

base64_encoded
boolean (optional) Default: false Example: false

Set to true if you want to receive Base64 encoded data.

fields
string (optional) Default: stdout,time,memory,stderr,token,compile_output,message,status Example: token,stdout,stderr,status_id,language_id

Return only the desired attributes.

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
@@ -735,7 +735,7 @@ 

Example URI

GET& } ] }

Statuses and Languages

Language

Get Languages
GET/languages/

Get active languages.

-

Example URI

GET https://ce.judge0.com/languages/
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
+

Example URI

GET https://extra-ce.judge0.com/languages/
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
   {
     "id": 45,
     "name": "Assembly (NASM 2.14.02)"
@@ -864,7 +864,7 @@ 

Example URI

GET& "id": 74, "name": "TypeScript (3.7.4)" } -]

Get a Language
GET/languages/{id}

Example URI

GET https://ce.judge0.com/languages/1
URI Parameters
HideShow
id
integer (required) Example: 1

Language ID.

+]

Get a Language
GET/languages/{id}

Example URI

GET https://extra-ce.judge0.com/languages/1
URI Parameters
HideShow
id
integer (required) Example: 1

Language ID.

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
   "id": 1,
   "name": "Bash (4.4)",
@@ -873,7 +873,7 @@ 

Example URI

GET& "compile_cmd": null, "run_cmd": "/usr/local/bash-4.4/bin/bash script.sh" }

Active and Archived Languages

Get Active and Archived Languages
GET/languages/all

Get active and archived languages.

-

Example URI

GET https://ce.judge0.com/languages/all
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
+

Example URI

GET https://extra-ce.judge0.com/languages/all
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
   {
     "id": 45,
     "name": "Assembly (NASM 2.14.02)",
@@ -1244,7 +1244,7 @@ 

Example URI

GET& "name": "TypeScript (3.7.4)", "is_archived": false } -]

Status

Get Statuses
GET/statuses

Example URI

GET https://ce.judge0.com/statuses
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
+]

Status

Get Statuses
GET/statuses

Example URI

GET https://extra-ce.judge0.com/statuses
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
   {
     "id": 1,
     "description": "In Queue"
@@ -1316,7 +1316,7 @@ 

Example URI

GET& different hosts with different system configurations. Result of this API request is always from web system. This means that this request might be irrelevant to you if you as user don’t know if web and worker are hosted on the same machine. To find that out, please contact admins who host Judge0 you are using.

-

Example URI

GET https://ce.judge0.com/system_info
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
+

Example URI

GET https://extra-ce.judge0.com/system_info
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
   "Architecture": "x86_64",
   "CPU op-mode(s)": "32-bit, 64-bit",
   "Byte Order": "Little Endian",
@@ -1612,7 +1612,7 @@ 

Example URI

GET&

For example, max_cpu_time_limit with value 20 means that user cannot create new submission which has cpu_time_limit greater than 20.

-

Example URI

GET https://ce.judge0.com/config_info
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
+

Example URI

GET https://extra-ce.judge0.com/config_info
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
   "enable_wait_result": true,
   "enable_compiler_options": true,
   "allowed_languages_for_compile_options": [],
@@ -1640,7 +1640,7 @@ 

Example URI

GET& "number_of_runs": 1, "max_number_of_runs": 20 }

Statistics

Statistics

Statistics
GET/statistics

Get some statistics from current instance. Result is cached for 10 minutes.

-

Example URI

GET https://ce.judge0.com/statistics
URI Parameters
HideShow
invalidate_cache
boolean (optional) Example: false

Set to true if you want to invalidate current cache and fetch new statistics.

+

Example URI

GET https://extra-ce.judge0.com/statistics
URI Parameters
HideShow
invalidate_cache
boolean (optional) Example: false

Set to true if you want to invalidate current cache and fetch new statistics.

Health Check

Workers

Workers
GET/workers

For each queue you will get:

  • @@ -1665,7 +1665,7 @@

    Example URI

    GET&

    how many jobs failed

-

Example URI

GET https://ce.judge0.com/workers
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
+

Example URI

GET https://extra-ce.judge0.com/workers
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
   {
     "queue": "default",
     "size": 0,
@@ -1676,15 +1676,15 @@ 

Example URI

GET& "failed": 0 } ]

Information

About

About
GET/about

Returns general information.

-

Example URI

GET https://ce.judge0.com/about
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
+

Example URI

GET https://extra-ce.judge0.com/about
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
   "version": "1.5.0",
   "homepage": "https://judge0.com",
   "source_code": "https://github.com/judge0/judge0",
   "maintainer": "Herman Zvonimir Došilović <hermanz.dosilovic@gmail.com>"
 }

Version

Version
GET/version

Returns current version.

-

Example URI

GET https://ce.judge0.com/version

Isolate

Isolate
GET/isolate

Returns result of isolate --version.

-

Example URI

GET https://ce.judge0.com/isolate

License

License
GET/license

Returns a license.

-

Example URI

GET https://ce.judge0.com/license

Generated by aglio on 17 Apr 2024

+ \ No newline at end of file From 6844314c881396ebd0772a7f9e6f079f35cfaf30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herman=20Zvonimir=20Do=C5=A1ilovi=C4=87?= Date: Wed, 17 Apr 2024 22:44:58 +0000 Subject: [PATCH 18/21] Remove VIRTUAL_PORT env --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7668f7be..711e9258 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,8 +22,7 @@ RUN apt-get update -o Acquire::Check-Valid-Until=false && \ gem install bundler:2.1.4 && \ npm install -g --unsafe-perm aglio@2.3.0 -ENV VIRTUAL_PORT 2358 -EXPOSE $VIRTUAL_PORT +EXPOSE 2358 WORKDIR /api From 5dcb7abcf3126714954592ee727269a239c3a130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herman=20Zvonimir=20Do=C5=A1ilovi=C4=87?= Date: Wed, 17 Apr 2024 22:46:54 +0000 Subject: [PATCH 19/21] Remove vim installation from development --- Dockerfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 711e9258..3cdcd1e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,8 +49,4 @@ LABEL version=$JUDGE0_VERSION FROM production AS development -RUN sudo apt-get update -o Acquire::Check-Valid-Until=false && \ - sudo apt-get install -y --no-install-recommends \ - vim - CMD ["sleep", "infinity"] From 7a885609b0332e8c796b64654b0fd3ac80156e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herman=20Zvonimir=20Do=C5=A1ilovi=C4=87?= Date: Wed, 17 Apr 2024 22:51:56 +0000 Subject: [PATCH 20/21] Update gitignore --- .gitignore | 1 + judge0.conf | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 80e4978b..d9c76d50 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ tmp/* .byebug_history coverage/ srv/ +environment diff --git a/judge0.conf b/judge0.conf index cc70bf63..ef510584 100644 --- a/judge0.conf +++ b/judge0.conf @@ -196,7 +196,7 @@ REDIS_PORT= # Specify Redis password. Cannot be blank. # Default: NO DEFAULT! MUST BE SET! -REDIS_PASSWORD=YourPasswordHere1234 +REDIS_PASSWORD= ################################################################################ @@ -220,7 +220,7 @@ POSTGRES_USER=judge0 # Password of the user. Cannot be blank. Used only in production. # Default: NO DEFAULT, YOU MUST SET YOUR PASSWORD -POSTGRES_PASSWORD=YourPasswordHere1234 +POSTGRES_PASSWORD= ################################################################################ From 80a8d940052598cc5656908a7550b483c7ba8887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herman=20Zvonimir=20Do=C5=A1ilovi=C4=87?= Date: Wed, 17 Apr 2024 23:27:32 +0000 Subject: [PATCH 21/21] Update Redis --- docker-compose.dev.yml | 4 ++-- docker-compose.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 57582662..0a4e9154 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -19,10 +19,10 @@ services: restart: always redis: - image: redis:6.2.14 + image: redis:7.2.4 command: [ "bash", "-c", - 'docker-entrypoint.sh --appendonly yes --requirepass "$$REDIS_PASSWORD"' + 'docker-entrypoint.sh --appendonly no --requirepass "$$REDIS_PASSWORD"' ] env_file: judge0.conf restart: always diff --git a/docker-compose.yml b/docker-compose.yml index 7cc95bc9..596a9c5f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,10 +34,10 @@ services: restart: always redis: - image: redis:6.2.14 + image: redis:7.2.4 command: [ "bash", "-c", - 'docker-entrypoint.sh --appendonly yes --requirepass "$$REDIS_PASSWORD"' + 'docker-entrypoint.sh --appendonly no --requirepass "$$REDIS_PASSWORD"' ] env_file: judge0.conf <<: *default-logging pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy