Giter Site home page Giter Site logo

judgeserver's Introduction

judgeserver's People

Contributors

devnoname120 avatar happystraw avatar helsonxiao avatar mikucat0309 avatar nb-dragon avatar venus-robot avatar virusdefender avatar volltin avatar zema1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

judgeserver's Issues

Problems in using third party libraries

单独调用评测机的接口时,想要评测一些加了第三方库的代码时出现问题。请问如何在评测机中完成第三方库的调用?

运行client里的client.py报错“failed to create runtime dir”

ping
({u'data': {u'judger_version': u'2.1.1', u'hostname': u'218ddf064089', u'cpu_core': 1, u'memory': 80.1, u'action': u'pong', u'cpu': 6.6}, u'err': None}, '\n\n')
compile_spj
({u'data': u"FileNotFoundError :[Errno 2] No such file or directory: '/judger/spj/spj-2.c'", u'err': u'JudgeClientError'}, '\n\n')
c_judge
({u'data': u'failed to create runtime dir', u'err': u'JudgeClientError'}, '\n\n')
cpp_judge
({u'data': u'failed to create runtime dir', u'err': u'JudgeClientError'}, '\n\n')
java_judge
({u'data': u'failed to create runtime dir', u'err': u'JudgeClientError'}, '\n\n')
c_spj_judge
({u'data': u"FileNotFoundError :[Errno 2] No such file or directory: '/judger/spj/spj-3.c'", u'err': u'JudgeClientError'}, '\n\n')
py2_judge
({u'data': u'failed to create runtime dir', u'err': u'JudgeClientError'}, '\n\n')
py3_judge
({u'data': u'failed to create runtime dir', u'err': u'JudgeClientError'}, '\n\n')

关于评测队列

请问当多个用户同时提交代码时评测机会怎么处理?同时评测多个还是一次一个,前一个结束之后再测下一个?

The problem of using third party Library

请教一下,在单调用judgeserver评测机时,想要加第三方库,在dockerfile中的run 后面添加了想要加入的包后,要如何重构镜像,放在docker-compose.yml文件中,让其他的配置都不变,能够正常运行呢?谢谢您!
qq 20181102150429

api 请求包错

image

日志:

2019-07-29 06:33:59,805 ERROR 'str' object has no attribute 'get'
Traceback (most recent call last):
  File "/code/server.py", line 192, in server
    ret = {"err": None, "data": getattr(JudgeServer, path)(**data)}
  File "/code/server.py", line 68, in judge
    compile_config = language_config.get("compile")
AttributeError: 'str' object has no attribute 'get'

看日志, 应该是传入 参数问题

	"language_config": "py3_lang_config",

看了 client/Python/languages.py 确实是这个

Judge Server Failed

Thanks for the maintainance, I'm trying to use the latest judge server, the building process is fine, but its health check fails, which makes backend server down. Seems like the new setup have some error.

ModuleNotFoundError: No module named 'idna'

使用registry.cn-hangzhou.aliyuncs.com/onlinejudge/judge_server的镜像健康检查失败,进入容器内部执行python3 service.py命令报以下错误,,自己构建的则没问题。

root@219642eee455:/code# python3 service.py 
Traceback (most recent call last):
  File "service.py", line 4, in <module>
    import requests
  File "/usr/local/lib/python3.6/dist-packages/requests/__init__.py", line 121, in <module>
    from . import packages
  File "/usr/local/lib/python3.6/dist-packages/requests/packages.py", line 7, in <module>
    locals()[package] = __import__(package)
ModuleNotFoundError: No module named 'idna'

服务器环境下不能导入题目

Linux环境Ubuntu16.04不能导入题目,导入题目出现Server Error。我们环境是用阿里云服务器的。但是本地Linux也是Ubuntu16.04,导入题目却没有出现Server Error 能够正常导入题目。请问下,这是什么原因?谢谢

problem with addding js to language configs

I have added this config to language configs:

js_lang_config = {
   "run": {
       "exe_name": "solution.js",
       "command": "/usr/bin/nodejs {exe_path}",
       "seccomp_rule": "general",
   }
}

and this line to Dockerfile
RUN apt-get install -y nodejs

any code that is run with js language config returns runtime error.
when I run the code directly from docker I get the correct result I'm expecting

最大内存1MB?

填写max_memory 超过 1073741824 (1MB)就会报错

Traceback (most recent call last):
  File "/usr/lib/python3.5/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/code/judge_client.py", line 18, in _run
    return instance._judge_one(test_case_file_id)
  File "/code/judge_client.py", line 122, in _judge_one
    memory_limit_check_only=self._run_config.get("memory_limit_check_only", 0))
  File "/usr/local/lib/python3.5/dist-packages/_judger/__init__.py", line 84, in run
    return json.loads(out.decode("utf-8"))
  File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/code/server.py", line 142, in server
    ret = {"err": None, "data": getattr(JudgeServer, path)(**data)}
  File "/code/server.py", line 100, in judge
    run_result = judge_client.run()
  File "/code/judge_client.py", line 165, in run
    result.append(item.get())
  File "/usr/lib/python3.5/multiprocessing/pool.py", line 608, in get
    raise self._value
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2019-04-10 15:25:42,665 ERROR Expecting value: line 1 column 1 (char 0)
multiprocessing.pool.RemoteTraceback:

Build Docker镜像失败

DockerFile 里面这一段 echo $phpJitOption > /etc/php/8.0/cli/conf.d/10-opcache-jit.ini,需要改成 php/8.1,因为现在8.1是正式版本,默认前面会安装PHP8.1,所以目录不对了,这个地方可能需要调整一下,不然之后8.2如果出来了又要改。

请问能否给个JudgeServer /judge的请求样例

您好,请问是否发一份JudgeServer /judge的请求样例
或者能不能帮我看看这是什么问题?
{ "src": "#include<stdio.h> int main() {int a,b; scanf(\"%d%d\", &a,&b); printf(\"%d\", a+b); return 0;}", "language_config": { "compile": { "src_name": "main.c", "exe_name": "main", "max_cpu_time": 3000, "max_real_time": 5000, "max_memory": 134217728, "compile_command": "/usr/bin/gcc -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c99 {src_path} -lm -o {exe_path}" }, "run": { "command": "{exe_path}", "seccomp_rule": "c_cpp", "env": ["LANG=en_US.UTF-8", "LANGUAGE=en_US:en", "LC_ALL=en_US.UTF-8"] } }, "max_cpu_time": 3000, "max_memory": 134217728, "test_case_id": "normal", "output": "false" }

返回的响应是:
{ "err": "CompileError", "data": "/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function _start':\n(.text+0x20): undefined reference to main'\ncollect2: error: ld returned 1 exit status" }

Getting the following error. How to resolve this ?

Compile Error
/judger/run/1d3f9a7de8a3467d9f7544015811b33c/main.c:10:5: error: redefinition of 'main'
int main() {
^~~~
/judger/run/1d3f9a7de8a3467d9f7544015811b33c/main.c:4:5: note: previous definition of 'main' was here
int main(){
^~~~

Screen Shot 2021-05-25 at 2 11 41 PM

阿里云docker部署打,输出结果不正确,最后几位重复

cpu_time	:	12
error	:	0
exit_code	:	0
memory	:	3489792
output	:	65 32 93 34 73 96 32 39 58 72 52 68 71 28 93 21 21 21 21 21
output_md5	:	5b31766387f398a4c4d9d7b37b24e8e9
real_time	:	167
result	:	-1
signal	:	0
test_case	:	20

阿里云上docker部署的,总是出现这种最后几个输出完全一样的结果。奇怪的是我本地跑同样的代码可以得到正确的结果

[API] get JudgeClientError, "ping() argument after ** must be a mapping, not NoneType"

你好,

我參考 judgeserver api 寫一個python程式想要檢查system info

import hashlib
import requests

token = hashlib.sha256('CHANGE_THIS'.encode('utf-8')).hexdigest()
headers = {'X-Judge-Server-Token': str(token), }
response = requests.post('http://172.18.0.3:8080/ping', headers=headers)
print(response.content)

卻得到 JudgeClientError 錯誤:

{"data": "TypeError :ping() argument after ** must be a mapping, not NoneType", "err": "JudgeClientError"}

請問怎麼解決??

能否支持下JavaScript语言?

我们在使用这个平台在公司内举办比赛 前端们也很希望参加进来 但是发现语言不支持 希望大佬们考虑一下~

complie error

/judger/run/6a9d0d474dca4801b1806774b861a619/main.c: In function 'main':
/judger/run/6a9d0d474dca4801b1806774b861a619/main.c:7:5: error: 'cout' undeclared (first use in this function)
cout << "Before swapping." << endl;
^~~~
/judger/run/6a9d0d474dca4801b1806774b861a619/main.c:7:5: note: each undeclared identifier is reported only once for each function it appears in
/judger/run/6a9d0d474dca4801b1806774b861a619/main.c:7:35: error: 'endl' undeclared (first use in this function)
cout << "Before swapping." << endl;
^~~~
/judger/run/6a9d0d474dca4801b1806774b861a619/main.c: At top level:
/judger/run/6a9d0d474dca4801b1806774b861a619/main.c:19:5: error: redefinition of 'main'
int main() {
^~~~
/judger/run/6a9d0d474dca4801b1806774b861a619/main.c:3:5: note: previous definition of 'main' was here
int main()
^~~~
Issue 1

提交带有中文的代码会SE,但是我在qdoj.com提交就没问题?

Traceback (most recent call last):
  File "/code/server.py", line 213, in server
    ret = {"err": None, "data": getattr(JudgeServer, path)(**data)}
  File "/code/server.py", line 120, in judge
    output_dir=submission_dir)
  File "/code/compiler.py", line 39, in compile
    error = f.read().strip()
  File "/usr/lib/python3.5/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 99: invalid continuation byte```

编译时最大输出限制

max_output_size=1024 * 1024,

为什么这个max_output_size限制了g++二进制文件输出的大小?

image
上图中分别为加上max_output_size与去掉max_output_size执行

/usr/lib/judger/libjudger.so \
    --exe_path=/usr/bin/g++ \
    --max_cpu_time=10000 \
    --max_real_time=20000 \
    --max_memory=134217728 \
    --max_stack=134217728 \
    --max_process_number=-1 \
    --max_output_size=1048576 \
    --log_path=/opt/compile/run.log \
    --error_path=/opt/compile/error.log \
    --args="-DONLINE_JUDGE" \
    --args="-O2" --args="-w" \
    --args="-fmax-errors=3" --args="-std=c++17" \
    --args="/opt/compile/main.cpp" \
    --args="-lm" --args="-o" --args="/opt/run/main" \
    --env="PATH=$PATH" \
    --uid=0 \
    --gid=0 # > /opt/compile/result.log

的结果

subprocess.Popen

proc = subprocess.Popen(proc_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE,shell=True)
out, err = proc.communicate()我运行测试的时候发现out和err都是空字符串,这是为什么?

请问有人遇到测试用例找不到之后进程睡眠占用内存的问题吗?

日志:
2020-06-14 16:29:02,547 ERROR
Traceback (most recent call last):
File "/code/judge_client.py", line 51, in _load_test_case_info
with open(os.path.join(self._test_case_dir, "info")) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/test_case/1/info'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/code/server.py", line 189, in server
ret = {"err": None, "data": getattr(JudgeServer, path)(**data)}
File "/code/server.py", line 144, in judge
output=output)
File "/code/judge_client.py", line 36, in init
self._test_case_info = self._load_test_case_info()
File "/code/judge_client.py", line 54, in _load_test_case_info
raise JudgeClientError("Test case not found")

查看实时进程:

root@4104fd566a2c:/# top
top - 23:20:36 up 8:07, 0 users, load average: 0.19, 0.19, 0.22
Tasks: 11 total, 1 running, 10 sleeping, 0 stopped, 0 zombie
%Cpu(s): 1.3 us, 1.3 sy, 0.0 ni, 97.0 id, 0.3 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 498728 total, 17624 free, 198344 used, 282760 buff/cache
KiB Swap: 2097148 total, 1934332 free, 162816 used. 187844 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
16 root 20 0 709756 24468 2844 S 0.3 4.9 0:08.57 gunicorn
1 root 20 0 4492 564 548 S 0.0 0.1 0:00.05 sh
5 root 20 0 60584 14904 2448 S 0.0 3.0 0:01.46 gunicorn
15 root 20 0 683012 23916 2476 S 0.0 4.8 0:08.10 gunicorn
34 root 20 0 166876 22216 964 S 0.0 4.5 0:00.00 gunicorn
56 root 20 0 18256 1576 1076 S 0.0 0.3 0:00.09 bash
164 root 20 0 240604 22228 972 S 0.0 4.5 0:00.00 gunicorn
171 root 20 0 461816 22380 960 S 0.0 4.5 0:00.00 gunicorn
178 root 20 0 461820 22396 968 S 0.0 4.5 0:00.00 gunicorn
4591 root 20 0 36652 1668 1244 R 0.0 0.3 0:00.06 top
4723 root 20 0 709756 22752 1068 S 0.0 4.6 0:00.00 gunicorn

所有进程:
root@4104fd566a2c:/# ps aux | more
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.1 4492 564 ? Ss 21:56 0:00 /bin/sh -c /code/entrypoint.sh
root 5 0.0 2.8 60584 14096 ? S 21:56 0:01 /usr/bin/python3 /usr/local/bin
/gunicorn --workers 2 --threads 2 --error-logfile /log/gunicorn.log --time 600 --bind 0.0.0.0:80
80 server:app
root 15 0.1 4.7 683012 23444 ? Sl 21:57 0:09 /usr/bin/python3 /usr/local/bin
/gunicorn --workers 2 --threads 2 --error-logfile /log/gunicorn.log --time 600 --bind 0.0.0.0:80
80 server:app
root 16 0.1 4.8 709756 23992 ? Sl 21:57 0:10 /usr/bin/python3 /usr/local/bin
/gunicorn --workers 2 --threads 2 --error-logfile /log/gunicorn.log --time 600 --bind 0.0.0.0:80
80 server:app
root 34 0.0 4.3 166876 21740 ? S 21:57 0:00 /usr/bin/python3 /usr/local/bin
/gunicorn --workers 2 --threads 2 --error-logfile /log/gunicorn.log --time 600 --bind 0.0.0.0:80
80 server:app
root 56 0.0 0.3 18256 1632 pts/0 Ss 21:57 0:00 /bin/bash
root 164 0.0 4.3 240604 21752 ? S 21:59 0:00 /usr/bin/python3 /usr/local/bin
/gunicorn --workers 2 --threads 2 --error-logfile /log/gunicorn.log --time 600 --bind 0.0.0.0:80
80 server:app
root 171 0.0 4.3 461816 21908 ? S 21:59 0:00 /usr/bin/python3 /usr/local/bin
/gunicorn --workers 2 --threads 2 --error-logfile /log/gunicorn.log --time 600 --bind 0.0.0.0:80
80 server:app
root 178 0.0 4.3 461820 21928 ? S 21:59 0:00 /usr/bin/python3 /usr/local/bin
/gunicorn --workers 2 --threads 2 --error-logfile /log/gunicorn.log --time 600 --bind 0.0.0.0:80
80 server:app
root 4723 0.0 4.4 709756 22276 ? S 23:20 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 2 --thr
eads 2 --error-logfile /log/gunicorn.log --time 600 --bind 0.0.0.0:8080 server:app
root 5434 0.0 0.2 34412 1432 pts/0 R+ 23:33 0:00 ps aux
root 5435 0.0 0.1 6588 696 pts/0 S+ 23:33 0:00 more

是否应该帮用户 rstrip 掉输出中间行末尾的空格?

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    int singer1[6] = {8, 4, 6, 7, 5, 6};
    int singer2[6] = {5, 6, 3, 6, 4, 2};
    int singer3[6] = {3, 2, 4, 2, 3, 5};
    int num;
    scanf("%d", &num);
    printf(
        "%d %d %d   \n%d",
        singer1[num - 1], singer2[num - 1], singer3[num - 1],
        singer1[num - 1] + singer2[num - 1] + singer3[num -1]
    );
    return 0;
}

输出样例 1

8 5 3
16

用户输出

8 5 3   
16

这是一个测试用的程序,注意 "%d %d %d \n%d" 中,\n 之前的空格会导致答案错误。因为 Judger 在比较「用户输出」和「标准输出」时,只抹掉了用户输出最后一行的空格和换行符,输出中间行末尾的空格没有处理。

我把输出比较函数改成了如下

    def _compare_output(self, test_case_file_id, user_output_file):
        with open(user_output_file, "rb") as f:
            # 目前在上传测试用例时只去掉了最后一行的空格以及换行符,中间行末的空格没有去除,有待优化,但我们可以先帮用户 rstrip 掉
            output_lines = f.readlines()
            stripped_output_lines = [line.rstrip() for line in output_lines]
            content = b'\n'.join(stripped_output_lines)
        output_md5 = hashlib.md5(content.rstrip()).hexdigest()
        result = output_md5 == self._get_test_case_file_info(test_case_file_id)["stripped_output_md5"]
        return output_md5, result

problem with using docker-compose deploying JudgeServer

在安装好了最新版本的docker和docker-compose后,想要直接用judgeserver中的.yml文件直接部署,在下载好.yml文件后使用docker-compose -f docker-compose.example.yml up命令后,停留在如下所示的情况,进程没有结束,但是无论等多久也没有变化了。请问这是什么原因,为什么部署不成功?谢谢!
8f7e12270ec5_judgeserver-master_judge_server_1 is up-to-date
Attaching to 8f7e12270ec5_judgeserver-master_judge_server_1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.