This commit is contained in:
virusdefender 2016-10-22 21:37:21 +08:00
parent 27e4c9ba6a
commit 85d6b38a7a
6 changed files with 11 additions and 7 deletions

View File

@ -214,6 +214,7 @@ services:
<pre><code class="js"> {
&quot;judger_version&quot;: &quot;2.0.1&quot;,
&quot;hostname&quot;: &quot;c45acd557074&quot;,
&quot;running_task_number&quot;: 2,
&quot;cpu_core&quot;: 1,
&quot;memory&quot;: 30.3,
&quot;action&quot;: &quot;heartbeat&quot;,

View File

@ -219,6 +219,7 @@
<pre><code class="js">{
&quot;judger_version&quot;: &quot;2.0.1&quot;,
&quot;hostname&quot;: &quot;d3765528134e&quot;,
&quot;running_task_number&quot;: 2,
// number of cpu cores, this value will determine the number of concurrent tasks
&quot;cpu_core&quot;: 1,
// usage of cpu and memory

View File

@ -97,7 +97,7 @@
},
{
"location": "/JudgeServer/English/",
"text": "JudgeServer API\n\n\nPreparement\n\n\n\n\nX-Judge-Server-Token\n HTTP header is required for all requests, the value of this header is \nsha256(token)\n.\n\n\nType of request and response data is JSON.\n\n\nRequest method is \nPOST\n.\n\n\n\n\nFor all responses, \nerr\n and \ndata\n fields will be returned. \n\n\n\n\nIf the request is processed successfully, \nerr\n field will be \nnull\n, \ndata\n field will be the data returned. \n\n\nIf error occured while processing request, \nerr\n field will be error code, \ndata\n field will be the reason.\n\n\n\n\n\n\n\n\nGet system info\n\n\n\n\nURL \n/ping\n\n\n\n\nArgs\n\n\n\n\nDo not need args\n\n\n\n\nResponse\n\n\n{\n \njudger_version\n: \n2.0.1\n,\n \nhostname\n: \nd3765528134e\n,\n // number of cpu cores, this value will determine the number of concurrent tasks\n \ncpu_core\n: 1,\n // usage of cpu and memory\n \ncpu\n: 4.1,\n \nmemory\n: 24.5,\n \naction\n: \npong\n\n}\n\n\n\n\nJudge (not for Special Judge)\n\n\n\n\nURL \n/judge\n\n\n\n\nArgs\n\n\n\n\nsrc\n: source code\n\n\nlanguage_config\n: refer to \nclient/Python/languages.py\n, do not need to modify generally\n\n\nmax_cpu_time\n: unit is ms\n\n\nmax_memory\n: unit is byte\n\n\ntest_case_id\n: used to get the test_case directory\n\n\noutput\n: if this value is \ntrue\n, then user's output is returned else \nnull\n is returned. You can use this to debug your solution\n\n\n\n\nResponse\n\n\n[\n // each object/dict is a test case file running result\n {\n \ncpu_time\n: 1,\n // refer to the end of this document\n \nresult\n: 0,\n \nmemory\n: 12836864,\n \nreal_time\n: 2,\n \nsignal\n: 0,\n \nerror\n: 0,\n // refer to the end of this document\n \nexit_code\n: 0,\n \noutput_md5\n: \neccbc87e4b5ce2fe28308fd9f2a7baf3\n,\n // test case file id\n \ntest_case\n: 1\n },\n {\n \ncpu_time\n: 1,\n \nresult\n: 0,\n \nmemory\n: 12849152,\n \nreal_time\n: 1,\n \nsignal\n: 0,\n \nerror\n: 0,\n \nexit_code\n: 0,\n \noutput_md5\n: \neccbc87e4b5ce2fe28308fd9f2a7baf3\n,\n \ntest_case\n: 2\n }\n]\n\n\n\n\nWhen compilation is failed, following data will be returned\n\n\n{\n \nerr\n: \nCompileError\n, \n \ndata\n: \nerror resson\n\n}\n\n\n\n\nCompile Special Judge\n\n\n\n\nURL \n/compile_spj\n\n\n\n\nArgs\n\n\n\n\nsrc\n: special judge soure code\n\n\nspj_version\n: version of special judge, used to determine whether to recompile special judge\n\n\nspj_compile_config\n: refer to \nclient/Python/languages.py\n, do not need to modify generally\n\n\ntest_case_id\n\n\n\n\nResponse\n\n\nsuccess\n\n\n\n\n\nWhen compilation is failed, following data will be returned\n\n\n{\n \nerr\n: \nSPJCompileError\n, \n \ndata\n: \nerror resson\n\n}\n\n\n\n\nJudge (for Special Judge)\n\n\n\n\nURL \n/judge\n\n\n\n\nArgs\n\n\n\n\nsrc\n\n\nlanguage_config\n\n\nmax_cpu_time\n\n\nmax_memory\n\n\ntest_case_id\n\n\nspj_version\n\n\nspj_config\n, refer to \nclient/Python/languages.py\n, do not need to modify generally\n\n\nspj_compile_config\n: refer to \nclient/Python/languages.py\n, do not need to modify generally\n\n\nspj_src\n\n\noutput\n\n\n\n\nResponse\n\n\n[\n {\n \ncpu_time\n: 1,\n \nresult\n: 0,\n \nmemory\n: 12836864,\n \nreal_time\n: 2,\n \nsignal\n: 0,\n \nerror\n: 0,\n \nexit_code\n: 0,\n \noutput_md5\n: null,\n \ntest_case\n: 1\n },\n {\n \ncpu_time\n: 1,\n \nresult\n: 0,\n \nmemory\n: 12849152,\n \nreal_time\n: 1,\n \nsignal\n: 0,\n \nerror\n: 0,\n \nexit_code\n: 0,\n \noutput_md5\n: null,\n \ntest_case\n: 2\n }\n]\n\n\n\n\nWhen compilation is failed, following data will be returned\n\n\n{\n \nerr\n: \nCompileError\n, \n \ndata\n: \nerror reason\n\n}\n\n\n\n\nIf SPJ process crashed, \nresult = SYSTEM_ERROR\n and \nERROR = SPJ_ERROR\n is returned.\n\n\nresult\n field return value\n\n\n\n\nWRONG_ANSWER = -1 (this means the process exited normally, but the answer is wrong)\n\n\nSUCCESS = 0 (this means the answer is accepted)\n\n\nCPU_TIME_LIMIT_EXCEEDED = 1 \n\n\nREAL_TIME_LIMIT_EXCEEDED = 2\n\n\nMEMORY_LIMIT_EXCEEDED = 3\n\n\nRUNTIME_ERROR = 4\n\n\nSYSTEM_ERROR = 5\n\n\n\n\nerror\n field return value\n\n\n\n\nSUCCESS = 0\n\n\nINVALID_CONFIG = -1\n\n\nCLONE_FAILED = -2\n\n\nPTHREAD_FAILED = -3\n\n\nWAIT_FAILED = -4\n\n\nROOT_REQUIRED = -5\n\n\nLOAD_SECCOMP_FAILED = -6\n\n\nSETRLIMIT_FAILED = -7\n\n\nDUP2_FAILED = -8\n\n\nSETUID_FAILED = -9\n\n\nEXECVE_FAILED = -10\n\n\nSPJ_ERROR = -11",
"text": "JudgeServer API\n\n\nPreparement\n\n\n\n\nX-Judge-Server-Token\n HTTP header is required for all requests, the value of this header is \nsha256(token)\n.\n\n\nType of request and response data is JSON.\n\n\nRequest method is \nPOST\n.\n\n\n\n\nFor all responses, \nerr\n and \ndata\n fields will be returned. \n\n\n\n\nIf the request is processed successfully, \nerr\n field will be \nnull\n, \ndata\n field will be the data returned. \n\n\nIf error occured while processing request, \nerr\n field will be error code, \ndata\n field will be the reason.\n\n\n\n\n\n\n\n\nGet system info\n\n\n\n\nURL \n/ping\n\n\n\n\nArgs\n\n\n\n\nDo not need args\n\n\n\n\nResponse\n\n\n{\n \njudger_version\n: \n2.0.1\n,\n \nhostname\n: \nd3765528134e\n,\n \nrunning_task_number\n: 2,\n // number of cpu cores, this value will determine the number of concurrent tasks\n \ncpu_core\n: 1,\n // usage of cpu and memory\n \ncpu\n: 4.1,\n \nmemory\n: 24.5,\n \naction\n: \npong\n\n}\n\n\n\n\nJudge (not for Special Judge)\n\n\n\n\nURL \n/judge\n\n\n\n\nArgs\n\n\n\n\nsrc\n: source code\n\n\nlanguage_config\n: refer to \nclient/Python/languages.py\n, do not need to modify generally\n\n\nmax_cpu_time\n: unit is ms\n\n\nmax_memory\n: unit is byte\n\n\ntest_case_id\n: used to get the test_case directory\n\n\noutput\n: if this value is \ntrue\n, then user's output is returned else \nnull\n is returned. You can use this to debug your solution\n\n\n\n\nResponse\n\n\n[\n // each object/dict is a test case file running result\n {\n \ncpu_time\n: 1,\n // refer to the end of this document\n \nresult\n: 0,\n \nmemory\n: 12836864,\n \nreal_time\n: 2,\n \nsignal\n: 0,\n \nerror\n: 0,\n // refer to the end of this document\n \nexit_code\n: 0,\n \noutput_md5\n: \neccbc87e4b5ce2fe28308fd9f2a7baf3\n,\n // test case file id\n \ntest_case\n: 1\n },\n {\n \ncpu_time\n: 1,\n \nresult\n: 0,\n \nmemory\n: 12849152,\n \nreal_time\n: 1,\n \nsignal\n: 0,\n \nerror\n: 0,\n \nexit_code\n: 0,\n \noutput_md5\n: \neccbc87e4b5ce2fe28308fd9f2a7baf3\n,\n \ntest_case\n: 2\n }\n]\n\n\n\n\nWhen compilation is failed, following data will be returned\n\n\n{\n \nerr\n: \nCompileError\n, \n \ndata\n: \nerror resson\n\n}\n\n\n\n\nCompile Special Judge\n\n\n\n\nURL \n/compile_spj\n\n\n\n\nArgs\n\n\n\n\nsrc\n: special judge soure code\n\n\nspj_version\n: version of special judge, used to determine whether to recompile special judge\n\n\nspj_compile_config\n: refer to \nclient/Python/languages.py\n, do not need to modify generally\n\n\ntest_case_id\n\n\n\n\nResponse\n\n\nsuccess\n\n\n\n\n\nWhen compilation is failed, following data will be returned\n\n\n{\n \nerr\n: \nSPJCompileError\n, \n \ndata\n: \nerror resson\n\n}\n\n\n\n\nJudge (for Special Judge)\n\n\n\n\nURL \n/judge\n\n\n\n\nArgs\n\n\n\n\nsrc\n\n\nlanguage_config\n\n\nmax_cpu_time\n\n\nmax_memory\n\n\ntest_case_id\n\n\nspj_version\n\n\nspj_config\n, refer to \nclient/Python/languages.py\n, do not need to modify generally\n\n\nspj_compile_config\n: refer to \nclient/Python/languages.py\n, do not need to modify generally\n\n\nspj_src\n\n\noutput\n\n\n\n\nResponse\n\n\n[\n {\n \ncpu_time\n: 1,\n \nresult\n: 0,\n \nmemory\n: 12836864,\n \nreal_time\n: 2,\n \nsignal\n: 0,\n \nerror\n: 0,\n \nexit_code\n: 0,\n \noutput_md5\n: null,\n \ntest_case\n: 1\n },\n {\n \ncpu_time\n: 1,\n \nresult\n: 0,\n \nmemory\n: 12849152,\n \nreal_time\n: 1,\n \nsignal\n: 0,\n \nerror\n: 0,\n \nexit_code\n: 0,\n \noutput_md5\n: null,\n \ntest_case\n: 2\n }\n]\n\n\n\n\nWhen compilation is failed, following data will be returned\n\n\n{\n \nerr\n: \nCompileError\n, \n \ndata\n: \nerror reason\n\n}\n\n\n\n\nIf SPJ process crashed, \nresult = SYSTEM_ERROR\n and \nERROR = SPJ_ERROR\n is returned.\n\n\nresult\n field return value\n\n\n\n\nWRONG_ANSWER = -1 (this means the process exited normally, but the answer is wrong)\n\n\nSUCCESS = 0 (this means the answer is accepted)\n\n\nCPU_TIME_LIMIT_EXCEEDED = 1 \n\n\nREAL_TIME_LIMIT_EXCEEDED = 2\n\n\nMEMORY_LIMIT_EXCEEDED = 3\n\n\nRUNTIME_ERROR = 4\n\n\nSYSTEM_ERROR = 5\n\n\n\n\nerror\n field return value\n\n\n\n\nSUCCESS = 0\n\n\nINVALID_CONFIG = -1\n\n\nCLONE_FAILED = -2\n\n\nPTHREAD_FAILED = -3\n\n\nWAIT_FAILED = -4\n\n\nROOT_REQUIRED = -5\n\n\nLOAD_SECCOMP_FAILED = -6\n\n\nSETRLIMIT_FAILED = -7\n\n\nDUP2_FAILED = -8\n\n\nSETUID_FAILED = -9\n\n\nEXECVE_FAILED = -10\n\n\nSPJ_ERROR = -11",
"title": "API"
},
{
@ -122,7 +122,7 @@
},
{
"location": "/JudgeServer/English/#response",
"text": "{\n judger_version : 2.0.1 ,\n hostname : d3765528134e ,\n // number of cpu cores, this value will determine the number of concurrent tasks\n cpu_core : 1,\n // usage of cpu and memory\n cpu : 4.1,\n memory : 24.5,\n action : pong \n}",
"text": "{\n judger_version : 2.0.1 ,\n hostname : d3765528134e ,\n running_task_number : 2,\n // number of cpu cores, this value will determine the number of concurrent tasks\n cpu_core : 1,\n // usage of cpu and memory\n cpu : 4.1,\n memory : 24.5,\n action : pong \n}",
"title": "Response"
},
{
@ -182,7 +182,7 @@
},
{
"location": "/JudgeServer/English/deploy/",
"text": "Deploy\n\n\nReuqirements:\n\n\n\n\ndocker \n= 1.12\n\n\ndocker-compose \n= 1.8\n\n\n\n\nThree environment variables below must be set manully in \ndocker-compose.yml\n\n\n\n\nservice_discovery_url\n\n\njudger_token\n\n\nservice_url\n\n\n\n\njudge_server\n will send heartbeat request to \nservice_discovery_url\n every five seconds.\n\n\nservice_url\n is used to tell server to send task to this url(\njudge_server\n).\n\n\nExample of \ndocker-compose.yml\n\n\nversion: \n2\n\nservices:\n judge_server:\n image: judge_server\n cpu_quota: 90000\n read_only: true\n cap_drop:\n - SETPCAP\n - MKNOD\n - NET_BIND_SERVICE\n - SYS_CHROOT\n - SETFCAP\n - FSETID\n tmpfs:\n - /tmp\n - /judger_run:exec,mode=777\n - /spj:exec,mode=777\n volumes:\n - /data/JudgeServer/tests/test_case:/test_case:ro\n - /data/log:/log\n - /data/JudgeServer:/code:ro\n environment:\n - judger_token=token\n - service_discovery_url=https://virusdefender.net/service.php\n - service_url=http://1.2.3.4:12358\n ports:\n - \n0.0.0.0:12358:8080\n\n\n\n\n\nHeartbeat request\n\n\n\n\nMethod\n: \nPOST\n\n\nX-JUDGE-SERVER-TOKEN\n: \nsha256(token)\n\n\nContent-Type\n: \napplication/json\n\n\n\n\nRequest data\n\n\n {\n \njudger_version\n: \n2.0.1\n,\n \nhostname\n: \nc45acd557074\n,\n \ncpu_core\n: 1,\n \nmemory\n: 30.3,\n \naction\n: \nheartbeat\n,\n \ncpu\n: 0,\n \nservice_url\n: null or \nhttp://1.2.3.4:8005\n\n}\n\n\n\n\nIf everything is OK, you should give a JSON response as follows\n\n\n{\n \ndata\n: \nsuccess\n,\n \nerr\n: null\n}",
"text": "Deploy\n\n\nReuqirements:\n\n\n\n\ndocker \n= 1.12\n\n\ndocker-compose \n= 1.8\n\n\n\n\nThree environment variables below must be set manully in \ndocker-compose.yml\n\n\n\n\nservice_discovery_url\n\n\njudger_token\n\n\nservice_url\n\n\n\n\njudge_server\n will send heartbeat request to \nservice_discovery_url\n every five seconds.\n\n\nservice_url\n is used to tell server to send task to this url(\njudge_server\n).\n\n\nExample of \ndocker-compose.yml\n\n\nversion: \n2\n\nservices:\n judge_server:\n image: judge_server\n cpu_quota: 90000\n read_only: true\n cap_drop:\n - SETPCAP\n - MKNOD\n - NET_BIND_SERVICE\n - SYS_CHROOT\n - SETFCAP\n - FSETID\n tmpfs:\n - /tmp\n - /judger_run:exec,mode=777\n - /spj:exec,mode=777\n volumes:\n - /data/JudgeServer/tests/test_case:/test_case:ro\n - /data/log:/log\n - /data/JudgeServer:/code:ro\n environment:\n - judger_token=token\n - service_discovery_url=https://virusdefender.net/service.php\n - service_url=http://1.2.3.4:12358\n ports:\n - \n0.0.0.0:12358:8080\n\n\n\n\n\nHeartbeat request\n\n\n\n\nMethod\n: \nPOST\n\n\nX-JUDGE-SERVER-TOKEN\n: \nsha256(token)\n\n\nContent-Type\n: \napplication/json\n\n\n\n\nRequest data\n\n\n {\n \njudger_version\n: \n2.0.1\n,\n \nhostname\n: \nc45acd557074\n,\n \nrunning_task_number\n: 2,\n \ncpu_core\n: 1,\n \nmemory\n: 30.3,\n \naction\n: \nheartbeat\n,\n \ncpu\n: 0,\n \nservice_url\n: null or \nhttp://1.2.3.4:8005\n\n}\n\n\n\n\nIf everything is OK, you should give a JSON response as follows\n\n\n{\n \ndata\n: \nsuccess\n,\n \nerr\n: null\n}",
"title": "Deploy"
},
{
@ -192,7 +192,7 @@
},
{
"location": "/JudgeServer/English/deploy/#heartbeat-request",
"text": "Method : POST X-JUDGE-SERVER-TOKEN : sha256(token) Content-Type : application/json Request data {\n judger_version : 2.0.1 ,\n hostname : c45acd557074 ,\n cpu_core : 1,\n memory : 30.3,\n action : heartbeat ,\n cpu : 0,\n service_url : null or http://1.2.3.4:8005 \n} If everything is OK, you should give a JSON response as follows {\n data : success ,\n err : null\n}",
"text": "Method : POST X-JUDGE-SERVER-TOKEN : sha256(token) Content-Type : application/json Request data {\n judger_version : 2.0.1 ,\n hostname : c45acd557074 ,\n running_task_number : 2,\n cpu_core : 1,\n memory : 30.3,\n action : heartbeat ,\n cpu : 0,\n service_url : null or http://1.2.3.4:8005 \n} If everything is OK, you should give a JSON response as follows {\n data : success ,\n err : null\n}",
"title": "Heartbeat request"
}
]

View File

@ -4,7 +4,7 @@
<url>
<loc>None/</loc>
<lastmod>2016-10-18</lastmod>
<lastmod>2016-10-22</lastmod>
<changefreq>daily</changefreq>
</url>
@ -13,7 +13,7 @@
<url>
<loc>None/Judger/</loc>
<lastmod>2016-10-18</lastmod>
<lastmod>2016-10-22</lastmod>
<changefreq>daily</changefreq>
</url>
@ -29,7 +29,7 @@
<url>
<loc>None/JudgeServer/</loc>
<lastmod>2016-10-18</lastmod>
<lastmod>2016-10-22</lastmod>
<changefreq>daily</changefreq>
</url>

View File

@ -60,6 +60,7 @@ Request data
{
"judger_version": "2.0.1",
"hostname": "c45acd557074",
"running_task_number": 2,
"cpu_core": 1,
"memory": 30.3,
"action": "heartbeat",

View File

@ -24,6 +24,7 @@
{
"judger_version": "2.0.1",
"hostname": "d3765528134e",
"running_task_number": 2,
// number of cpu cores, this value will determine the number of concurrent tasks
"cpu_core": 1,
// usage of cpu and memory