Skip to content

jalgoarena/JAlgoArena-Judge

Repository files navigation

JAlgoArena Judge Agent Build Status codecov GitHub release

JAlgoArena Judge Agent is heart of JAlgoArena platform. It is responsible for generation of skeleton code as well as judging submissions based on requirements specified in problem definition.

Introduction

  • JAlgoArena Judge Agent can be easily scalable - it's stateless and together with Consul and API using Ribbon load balancer gives unlimited way to scale judgement capability
  • It supports Java 8
  • JAlgoArena Judge Agent is generating skeleton code for particular problem - based on meta data received from Problems Service
  • It judges correctness of the solution based on the pre-specified test cases as well as time and memory limits
  • It's using simple heuristic to calculate time and memory results - running in couple iteration and looking for best results makes the judgement itself more predictable and repeatable

Component Diagram

REST API

Endpoint Description
GET /problems Get problems list
GET /problems/:id Get problem by id

API

Get all problems

Request definition of all problems

URL Method
/problems GET
  • Success Response:

    List of available problems

    • Code: 200
      Content: [{"id":"fib","title":"Fibonacci","description":"<description>","timeLimit":1,"skeletonCode":"<skeleton code>","level":1},{...},...]
  • Sample Call:

    curl --header "Accept: application/json" \
         http://localhost:5008/problems

Get specific problem

Request definition of requested problem

URL Method
/problems/:id GET
  • Success Response:

    Details of requested problem

    • Code: 200
      Content: {"id":"fib","title":"Fibonacci","description":"<description>","timeLimit":1,"skeletonCode":"<skeleton code>","level":1}
  • Sample Call:

    curl --header "Accept: application/json" \
         http://localhost:5008/problems/fib

Running locally

There are two ways to run it - from sources or from binaries.

  • Default port: 8080

Running from binaries

  • go to releases page and download last app package (JAlgoArena-Judge-[version_number].zip)
  • after unpacking it, go to folder and run ./run.sh
  • you can modify port in run.sh script, depending on your infrastructure settings. The script itself can be found in here: run.sh

Running from sources

  • run git clone https://github.com/spolnik/JAlgoArena-Judge to clone locally the sources
  • now, you can build project with command ./gradlew clean bootRepackage which will create runnable jar package with app sources. Next, run java -Dserver.port=8080 -classpath "lib/*" -jar build/libs/jalgoarena-auth-*.jar which will start application
  • there is second way to run app with gradle. Instead of running above, you can just run ./gradlew clean bootRun

Notes

Component Diagram