-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconstants.js
49 lines (47 loc) · 1.58 KB
/
constants.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const fs = require("fs");
// Automatically reads from .in files in grader/testfiles
var testfiles = {};
fs.mkdir("grader/testcases", function(err) {
console.log(err || "testcases already exists");
});
var files = fs
.readdirSync("grader/testcases")
.filter(str => str.indexOf(".out") != -1);
for (var i = 0; i < files.length; i++) {
let outfile = files[i];
let result = Number(fs.readFileSync(`grader/testcases/${outfile}`));
let infile = outfile.replace(".out", ".in");
testfiles[infile] = result;
}
module.exports = {
testfiles,
// large tests, with minimum time taken.
// Any less and it's likely that the person is either cheating or using an inexact solution
largeTests: {
// "2.in": 1000
},
// In milliseconds
executionTimeout: 20000, // 20s per file
timeouts: {
// Configuration for dynamic timeout
minTotalExecution: 40000, // 40s for total execution
maxTotalExecution: 120000, // 2 minutes when there isn't
targetWaitTime: 20 * 60 * 1000 // target a maximum wait time of 20 minutes
},
executionTimeout: 20000, // 20s per file
queueName: "processQueue",
pubSubName: "processPubSub",
secretsSubmissionPrefix: "secretSubmission/",
resultsKey: "results",
nameIdKey: "names",
// secretIdKey: "secrets",
leaderboardKey: "leaderboard",
cheatersKey: "cheaters",
secretsNamesKey: "secretName",
webServerIP: process.env.SERVER_URL || "127.0.0.1:3000",
redisConnectionOptions: process.env.REDIS_URL || {},
validKeys: (process.env.VALID_KEYS || "").split(",").reduce((hash, key) => {
hash[key] = true;
return hash;
}, {})
};