stuff
This commit is contained in:
parent
b8dfaff861
commit
be7f518778
@ -181,7 +181,7 @@ var runnerFree = function(runner){
|
|||||||
};
|
};
|
||||||
|
|
||||||
var lxcTimeout = function(runner, time){
|
var lxcTimeout = function(runner, time){
|
||||||
time = time || 60000 // 900000; // 15 minutes
|
time = time || 900000; // 15 minutes
|
||||||
|
|
||||||
if(runner.hasOwnProperty('timeout')){
|
if(runner.hasOwnProperty('timeout')){
|
||||||
clearTimeout(runner.timeout);
|
clearTimeout(runner.timeout);
|
||||||
@ -305,7 +305,7 @@ router.get('/liststuff', function(req, res, next){
|
|||||||
|
|
||||||
router.post('/run/:ip?', function doRun(req, res, next){
|
router.post('/run/:ip?', function doRun(req, res, next){
|
||||||
console.log('hit runner route')
|
console.log('hit runner route')
|
||||||
var runner = label2runner[req.params.ip] || getAvailrunner();
|
var runner = label2runner[req.params.ip] || false;
|
||||||
console.log('')
|
console.log('')
|
||||||
return run(req, res, runner);
|
return run(req, res, runner);
|
||||||
});
|
});
|
||||||
|
15
testAPI.py
15
testAPI.py
@ -1,10 +1,19 @@
|
|||||||
import requests as r
|
import requests as r
|
||||||
import time
|
import time
|
||||||
|
|
||||||
def testAPI(times):
|
def testAPI(times=100, sleep=2):
|
||||||
errors = 0
|
errors = 0
|
||||||
|
|
||||||
for i in range(times):
|
for i in range(times):
|
||||||
res = r.post('http://codeland.bytedev.co:2000/api/run', data={'code': 'pwd'})
|
try:
|
||||||
if res.status_code != 200: errors +=1
|
res = r.post(
|
||||||
|
'http://codeland.bytedev.co:2000/api/run',
|
||||||
|
data={'code': 'pwd'}
|
||||||
|
)
|
||||||
|
if res.status_code != 200: errors += 1
|
||||||
|
print(i, res.status_code)
|
||||||
|
except:
|
||||||
|
print('caught error')
|
||||||
|
errors += 1
|
||||||
|
time.sleep(sleep)
|
||||||
print('errors ', errors)
|
print('errors ', errors)
|
Loading…
x
Reference in New Issue
Block a user