info
This commit is contained in:
parent
30525c984c
commit
3b356a48f8
@ -10,7 +10,7 @@ var timeoutEvents = {};
|
|||||||
var label2container = {};
|
var label2container = {};
|
||||||
var availContainers = [];
|
var availContainers = [];
|
||||||
var usedContainers = [];
|
var usedContainers = [];
|
||||||
var workers = {
|
var workers = {
|
||||||
clworker0: {
|
clworker0: {
|
||||||
ip: '104.236.77.157',
|
ip: '104.236.77.157',
|
||||||
name: 'clworker0'
|
name: 'clworker0'
|
||||||
@ -28,7 +28,7 @@ var getFreeMem = function(ip, callback){
|
|||||||
|
|
||||||
var lxcTimeout = function(container, time){
|
var lxcTimeout = function(container, time){
|
||||||
time = time || 900000; // 15 minutes
|
time = time || 900000; // 15 minutes
|
||||||
var keys = Object.keys(timeoutEvents)
|
var keys = Object.keys(timeoutEvents);
|
||||||
|
|
||||||
if(keys.indexOf(container.label) !== -1){
|
if(keys.indexOf(container.label) !== -1){
|
||||||
clearTimeout(timeoutEvents[container.label])
|
clearTimeout(timeoutEvents[container.label])
|
||||||
@ -38,8 +38,7 @@ var lxcTimeout = function(container, time){
|
|||||||
lxc.stop(name, container);
|
lxc.stop(name, container);
|
||||||
return startAll(container.worker);
|
return startAll(container.worker);
|
||||||
}, time);
|
}, time);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
var runner = function(req, res, container){
|
var runner = function(req, res, container){
|
||||||
lxcTimeout(container);
|
lxcTimeout(container);
|
||||||
@ -51,10 +50,11 @@ var runner = function(req, res, container){
|
|||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
code: req.body.code
|
code: req.body.code
|
||||||
})
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return request.post(httpOptions, function(error, response, body){
|
return request.post(httpOptions, function(error, response, body){
|
||||||
|
console.log('runner:', arguments)
|
||||||
body = JSON.parse(body);
|
body = JSON.parse(body);
|
||||||
body['ip'] = container.label;
|
body['ip'] = container.label;
|
||||||
return res.json(body);
|
return res.json(body);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user