Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
ssmp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vaclab
ssmp
Commits
c909ab66
Commit
c909ab66
authored
5 years ago
by
Thomas Bock
Browse files
Options
Downloads
Patches
Plain Diff
runmp timing
parent
f5c9af90
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
lib/conf.js
+2
-2
2 additions, 2 deletions
lib/conf.js
lib/load.js
+1
-2
1 addition, 2 deletions
lib/load.js
lib/observe.js
+15
-11
15 additions, 11 deletions
lib/observe.js
lib/worker.runMp.js
+53
-56
53 additions, 56 deletions
lib/worker.runMp.js
with
71 additions
and
71 deletions
lib/conf.js
+
2
−
2
View file @
c909ab66
...
...
@@ -40,7 +40,7 @@ var all = {
port
:
50005
},
system
:
{
heartbeat
:
2
00
,
heartbeat
:
5
00
,
par_delay_mult
:
100
,
// Multiplikator
db_delay_mult
:
200
,
// Multiplikator
vxi11_buffer_time
:
100
...
...
@@ -106,7 +106,7 @@ all.logger.streams.push({
type
:
'
raw
'
,
level
:
"
trace
"
,
stream
:
new
BunyanToGelfStream
({
host
:
'
172.30.56.22
'
,
host
:
'
a73435
'
,
port
:
12201
})
});
...
...
This diff is collapsed.
Click to expand it.
lib/load.js
+
1
−
2
View file @
c909ab66
...
...
@@ -15,7 +15,6 @@ var _ = require("underscore")
,
fetch
=
require
(
"
./load.fetch
"
)
,
distribute
=
require
(
"
./load.distribute
"
)
,
insert
=
require
(
"
./load.insert
"
)
,
log
=
bunyan
.
createLogger
(
conf
.
logger
)
,
mem
=
broker
.
createClient
({
port
:
conf
.
mem
.
port
})
,
ok
=
{
ok
:
true
}
...
...
@@ -226,4 +225,4 @@ exports.distribute = distribute;
exports
.
fetch
=
fetch
;
exports
.
expand_cust
=
expand_cust
;
exports
.
expand_task
=
expand_task
;
exports
.
insert
=
insert
;
\ No newline at end of file
exports
.
insert
=
insert
;
This diff is collapsed.
Click to expand it.
lib/observe.js
+
15
−
11
View file @
c909ab66
...
...
@@ -232,17 +232,18 @@ var observe = function (ch, path, cb){
mem
.
get
([
mpid
,
no
,
"
ctrl
"
],
function
(
err
,
cmdstr
){
if
(
!
err
){
mem
.
get
([
mpid
,
no
,
"
state
"
],
function
(
err
,
state
){
if
(
!
err
){
if
(
!
err
){
dispatch
([
mpid
,
no
,
"
ctrl
"
],
cmdstr
,
state
,
function
(
err
,
path
){
if
(
!
err
){
if
(
_
.
isFunction
(
cb
)){
cb
(
null
,
path
);
if
(
!
err
){
if
(
_
.
isFunction
(
cb
)){
cb
(
null
,
path
);
}
}
else
{
log
.
error
(
err
,
"
error on observe dispatch
"
);
stop_cont
(
path
,
"
stop_container_obs
"
,
timerId
,
cb
)
}
}
else
{
log
.
error
(
err
,
"
error on observe dispatch
"
);
stop_cont
(
path
,
"
stop_container_obs
"
,
timerId
,
cb
)
}
});
}
else
{
log
.
error
(
err
...
...
@@ -287,7 +288,7 @@ var observe = function (ch, path, cb){
exports
.
observe
=
observe
;
var
dispatch
=
function
(
path
,
cmdstr
,
state
,
cb
){
if
(
path
&&
_
.
isArray
(
path
)
&&
path
.
length
>=
2
){
if
(
path
&&
_
.
isArray
(
path
)
&&
path
.
length
>=
2
){
var
mpid
=
path
[
0
]
,
no
=
path
[
1
];
...
...
@@ -391,7 +392,10 @@ exports.time_to_exchange = time_to_exchange;
* @param {String} channel
*/
var
shout
=
function
(
path
,
channel
,
cmdstr
,
newstr
,
cb
){
if
(
path
&&
_
.
isArray
(
path
)
&&
path
.
length
>=
2
){
log
.
trace
(
ok
,
"
shout on
"
+
path
+
channel
+
"
,
"
+
cmdstr
+
"
,
"
+
newstr
);
if
(
path
&&
_
.
isArray
(
path
)
&&
path
.
length
>=
2
){
var
cmdarr
=
cmd_to_array
(
cmdstr
)
,
cmdH
=
_
.
first
(
cmdarr
)
...
...
This diff is collapsed.
Click to expand it.
lib/worker.runMp.js
+
53
−
56
View file @
c909ab66
...
...
@@ -23,60 +23,57 @@ var _ = require("underscore"),
* @param {Function} cb Callback Funktion
*/
module
.
exports
=
function
(
task
,
cb
)
{
var
path
=
task
.
Path
,
mpdef
=
task
.
Mp
,
cont
=
task
.
Container
,
ctitle
=
task
.
ContainerTitle
,
poll
=
1000
,
ro
=
{
ok
:
true
},
err
;
mem
.
get
([
mpdef
],
function
(
err
,
mp
)
{
if
(
_
.
isUndefined
(
mp
))
{
err
=
new
Error
(
"
get request to
"
+
mpdef
+
"
fails
"
);
log
.
error
(
err
,
"
mp not available
"
);
cb
(
err
);
}
else
{
var
idx
=
mp
.
meta
.
container
.
Title
.
indexOf
(
ctitle
);
if
(
idx
>
-
1
)
{
cont
=
idx
;
log
.
trace
(
ro
,
"
found container with title
"
+
ctitle
+
"
at position
"
+
idx
)
}
if
(
!
_
.
isUndefined
(
cont
))
{
var
cpath
=
[
mpdef
,
cont
,
"
ctrl
"
],
cmd
=
[
conf
.
ctrlStr
.
load
,
conf
.
ctrlStr
.
run
].
join
(
"
;
"
);
mem
.
set
(
cpath
,
cmd
,
function
(
err
)
{
if
(
!
err
)
{
var
inid
=
setInterval
(
function
()
{
mem
.
get
(
cpath
,
function
(
err
,
res
)
{
if
(
!
err
)
{
if
(
res
==
conf
.
ctrlStr
.
ready
)
{
clearTimeout
(
inid
);
cb
(
null
,
ro
);
}
}
else
{
clearTimeout
(
inid
);
err
=
new
Error
(
"
can not get mp below:
"
+
cpath
.
join
(
"
.
"
));
log
.
error
(
err
);
cb
(
err
);
}
});
},
poll
)
}
else
{
err
=
new
Error
(
"
can not set mp below:
"
+
cpath
.
join
(
"
.
"
));
log
.
error
(
err
);
cb
(
err
);
}
});
//set cmd
}
else
{
err
=
new
Error
(
"
can not find container with title:
"
+
ctitle
);
log
.
error
(
err
);
cb
(
err
);
}
}
});
// get cpath
var
path
=
task
.
Path
,
mpdef
=
task
.
Mp
,
cont
=
task
.
Container
,
ctitle
=
task
.
ContainerTitle
,
poll
=
1000
,
ro
=
{
ok
:
true
},
err
;
mem
.
get
([
mpdef
],
function
(
err
,
mp
)
{
if
(
_
.
isUndefined
(
mp
))
{
err
=
new
Error
(
"
get request to
"
+
mpdef
+
"
fails
"
);
log
.
error
(
err
,
"
mp not available
"
);
cb
(
err
);
}
else
{
var
idx
=
mp
.
meta
.
container
.
Title
.
indexOf
(
ctitle
);
if
(
idx
>
-
1
)
{
cont
=
idx
;
log
.
trace
(
ro
,
"
found container with title
"
+
ctitle
+
"
at position
"
+
idx
)
}
if
(
!
_
.
isUndefined
(
cont
))
{
var
cpath
=
[
mpdef
,
cont
,
"
ctrl
"
],
cmd
=
[
conf
.
ctrlStr
.
load
,
conf
.
ctrlStr
.
run
].
join
(
"
;
"
);
mem
.
set
(
cpath
,
cmd
,
function
(
err
)
{
if
(
!
err
)
{
// poll the ctrl path
var
inid
=
setInterval
(
function
()
{
mem
.
get
(
cpath
,
function
(
err
,
res
)
{
if
(
!
err
)
{
if
(
res
==
conf
.
ctrlStr
.
ready
)
{
clearTimeout
(
inid
);
cb
(
null
,
ro
);
}
}
else
{
clearTimeout
(
inid
);
err
=
new
Error
(
"
can not get mp below:
"
+
cpath
.
join
(
"
.
"
));
log
.
error
(
err
);
cb
(
err
);
}
});
},
poll
)
}
else
{
err
=
new
Error
(
"
can not set mp below:
"
+
cpath
.
join
(
"
.
"
));
log
.
error
(
err
);
cb
(
err
);
}
});
//set cmd
}
else
{
err
=
new
Error
(
"
can not find container with title:
"
+
ctitle
);
log
.
error
(
err
);
cb
(
err
);
}
}
});
// get cpath
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment