Skip to content
Snippets Groups Projects
Commit 6e43ac26 authored by wactbprot's avatar wactbprot
Browse files

select can now break after load

parent 40540941
No related branches found
No related tags found
No related merge requests found
...@@ -210,7 +210,7 @@ module.exports = function(cb) { ...@@ -210,7 +210,7 @@ module.exports = function(cb) {
}); });
server.put("/:id/:no/:struct", function(req, res, next) { server.put("/:id/:no/:struct", function(req, res, next) {
meth.put(req, function(err, ro){ meth.put(req, function(err, ro){
if(!err){ if(!err){
res.send(ro); res.send(ro);
}else{ }else{
......
...@@ -65,7 +65,9 @@ var all = { ...@@ -65,7 +65,9 @@ var all = {
stop : "stop", stop : "stop",
error : "error", error : "error",
work : "working", work : "working",
mon : "mon" mon : "mon",
yes : "yes",
no : "no"
}, },
fallbackvalues : { fallbackvalues : {
text:"", text:"",
......
...@@ -43,7 +43,7 @@ module.exports = function (task, cb){ ...@@ -43,7 +43,7 @@ module.exports = function (task, cb){
+ TaskDefClass + TaskDefClass
+ " have to investigate " + " have to investigate "
+ Ncond + " condition(s)"); + Ncond + " condition(s)");
check_def(path, def, 0, cb); check_def(task, def, 0, cb);
}else{ }else{
log.trace(ro log.trace(ro
, "DefinitionClass " + definitions[i].DefinitionClass + , "DefinitionClass " + definitions[i].DefinitionClass +
...@@ -76,16 +76,18 @@ module.exports = function (task, cb){ ...@@ -76,16 +76,18 @@ module.exports = function (task, cb){
} }
} }
var check_def = function(path, def, j, cb){ var check_def = function(task, def, j, cb){
var mpid = path[0] var path = task.Path
, no = path[1] , mpid = path[0]
, N = def.Condition.length , no = path[1]
, cond = def.Condition[j] , N = def.Condition.length
, load_run = ctrlstr.load + ";" + ctrlstr.run; , cond = def.Condition[j]
, load_run = ctrlstr.load + ";" + ctrlstr.run
mem.get([mpid,"exchange"].concat(cond.ExchangePath.split(".")), function(err, exval){ , load_stop = ctrlstr.load + ";" + ctrlstr.stop;
if(!err){
if(_.isUndefined(exval) || _.isNull(exval) || _.isNaN(exval)){ mem.get([mpid,"exchange"].concat(cond.ExchangePath.split(".")), function(err, exval){
if(!err){
if(_.isUndefined(exval) || _.isNull(exval) || _.isNaN(exval)){
err = new Error("uncomparable exchange value"); err = new Error("uncomparable exchange value");
log.error(err log.error(err
, "exchange value some kind of undefined"); , "exchange value some kind of undefined");
...@@ -112,25 +114,26 @@ var check_def = function(path, def, j, cb){ ...@@ -112,25 +114,26 @@ var check_def = function(path, def, j, cb){
if(!err){ if(!err){
log.trace(ro log.trace(ro
, "set definition for container: " , "set definition for container: "
+ no ); + no );
mem.set([mpid, no, "ctrl"], load_run, function(err){ var set_cmd = task.Break == ctrlstr.yes ? load_stop : load_run;
mem.set([mpid, no, "ctrl"], set_cmd, function(err){
if(!err){ if(!err){
log.trace(ro log.trace(ro
, "set ctrl for container: " , "set ctrl for container: "
+ no + no
+ " to " + " to "
+ load_run); + set_cmd);
mem.publish("start_container_obs", [mpid, no], function(err){ mem.publish("start_container_obs", [mpid, no], function(err){
if(!err){ if(!err){
log.trace(ro log.trace(ro
, "start observing container"); , "start observing container");
cb(null, {end: true}); cb(null, {end: true});
}else{ }else{
log.error(err log.error(err
, "on attempt to publish to " , "on attempt to publish to "
+ "start_container_obs channel"); + "start_container_obs channel");
if(_.isFunction(cb)){ if(_.isFunction(cb)){
cb(err); cb(err);
} }
} }
}); });
...@@ -162,7 +165,7 @@ var check_def = function(path, def, j, cb){ ...@@ -162,7 +165,7 @@ var check_def = function(path, def, j, cb){
}else{ }else{
log.trace(ro log.trace(ro
, "check next state; call with "); , "check next state; call with ");
check_def(path, def, j + 1, cb); check_def(task, def, j + 1, cb);
} }
}else{ }else{
log.trace(cond log.trace(cond
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"author": "wactbprot", "author": "wactbprot",
"name": "ssmp", "name": "ssmp",
"description": "server side measurment program", "description": "server side measurment program",
"version": "1.2.0", "version": "1.3.0",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/wactbprot/ssmp" "url": "https://github.com/wactbprot/ssmp"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment