{ "uuid", types.varchar unique: true },
{ "problem_id", types.foreign_key },
{ "testcase_order", types.integer, default: 1 }
- { "input", types.varchar },
- { "output", types.varchar },
+ { "input", types.text },
+ { "output", types.text },
"PRIMARY KEY (id)"
}
server {
listen ${{PORT}};
lua_code_cache ${{CODE_CACHE}};
+ client_max_body_size 0;
+ client_body_buffer_size 200000k;
location / {
set $_url "http://192.168.0.4:8080";
div class: "highlight pad-l-12 pad-r-12 pad-t-4 pad-b-4 split-lr", ->
div "Problem:"
a href: (@url_for 'problem.description', { problem_name: @problem.short_name }), "#{@problem.name}"
+ div class: 'hightlight pad-l-12 pad-r-12 pad-t-4 pad-b-4 split-lr', ->
+ div "Time limit:"
+ div "#{@problem.time_limit}ms"
div class: "highlight pad-l-12 pad-r-12 pad-t-4 pad-b-4 split-lr", ->
div "Time submittted:"
div "#{ os.date '%c', @time_started }"
p "------------"
if type(@json_data.run_times[i]) == 'number'
- p "Run time: #{@json_data.run_times[i] / 1000000}s"
+ p "Run time: #{@json_data.run_times[i]}ms"
else
div class: 'header-line', ->
div @message
yield { status: 3, data: { completed: completed, total: total_cases, run_times: run_times } }
for test_case in test_cases
- res = await executer.execute exec_file.file_path, test_case.input, time_limit
+ test_case_file = new TempFile test_case.input
+ res = await executer.execute exec_file.file_path, test_case_file.file_path, time_limit
+ test_case_file.delete_file()
await new Promise (res) ->
setTimeout res, 200
err_output = ""
bash_shell.stderr.on 'data', (data) => err_output += data.toString()
- bash_shell.stdin.end "echo #{input} | timeout -s SIGKILL #{time_limit / 1000.0} #{path}"
+ bash_shell.stdin.end "cat #{input} | timeout -s SIGKILL #{time_limit / 1000.0} #{path}"
start_time = process.hrtime()
res_code = await on_child_exit bash_shell
diff_time = process.hrtime start_time
- run_time = diff_time[0] * 1000000 + Math.floor(diff_time[1] / 1000) / 1000000
+ run_time = (diff_time[0] * 1000000 + Math.floor(diff_time[1] / 1000)) / 1000000
if res_code == 0
return { status: 'SUCCESS', output: output, run_time: run_time }
err_output = ""
bash_shell.stderr.on 'data', (data) => err_output += data.toString()
- bash_shell.stdin.end "echo #{input} | timeout -s SIGKILL #{time_limit / 1000.0} python3 #{path}"
+ bash_shell.stdin.end "cat #{input} | timeout -s SIGKILL #{time_limit / 1000.0} python3 #{path}"
start_time = process.hrtime()
res_code = await on_child_exit bash_shell
diff_time = process.hrtime start_time
- run_time = diff_time[0] * 1000000 + Math.floor(diff_time[1] / 1000) / 1000000
+ run_time = (diff_time[0] * 1000000 + Math.floor(diff_time[1] / 1000)) / 1000000
if res_code == 0
return { status: 'SUCCESS', output: output, run_time: run_time }
app = express()
app.use (morgan 'dev')
-app.use bodyParser.urlencoded { extended: true }
+app.use bodyParser.urlencoded { extended: true, limit: '20mb' }
routes = require './app/routes'
routes(app)