A distributed code-execution library that divides large test cases into batches, stores them in Redis, and executes them efficiently using background workers.
JudgeLib divides large sets of test cases into smaller, manageable batches for faster and more efficient execution.
Test cases and execution data are stored and managed in Redis for fast retrieval and distributed coordination.
Background workers fetch batched test cases from Redis and execute them in isolated environments for maximum reliability.
npm install lib-judge
yarn add lib-judge
import { judge } from 'lib-judge';
// Sample testcases input
const input = '5 1 2 3 4 5 ### 3 10 20 30 ### 4 2 2 2 2';
const output = '15 ### 60 ### 8';
const result = await judge({
codePath: tmpPath, //path of the file
ques_name: 'sum of array',
input,
output,
language: 'cpp',
timeout: '2',
sizeout: '64'
});
// Internally:
// 1️⃣ Input is divided into batches
// 2️⃣ Stored in Redis
// 3️⃣ Workers pull batches and execute them asynchronously
console.log(result);3.11
17
GCC 11