Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xanadu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
SYNERG
xanadu
Commits
d72633d3
Commit
d72633d3
authored
Aug 05, 2020
by
nilanjandaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added worker host metrics to heartbeat
parent
3455f6d9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
10 deletions
+20
-10
dispatch_system/constants.json
dispatch_system/constants.json
+1
-1
dispatch_system/dispatch_daemon/index.js
dispatch_system/dispatch_daemon/index.js
+15
-4
dispatch_system/dispatch_manager/repository/worker_env/envTest.js
..._system/dispatch_manager/repository/worker_env/envTest.js
+4
-5
No files found.
dispatch_system/constants.json
View file @
d72633d3
...
...
@@ -4,7 +4,7 @@
"master_address"
:
"localhost"
,
"grunt_host"
:
"https://www.namandixit.net/lovecraftian_nightmares/grunt"
,
"couchdb_host"
:
"10.129.6.5:5984"
,
"env"
:
"env
Test
.js"
,
"env"
:
"env.js"
,
"db"
:
{
"function_meta"
:
"serverless"
,
"metrics"
:
"metrics"
,
...
...
dispatch_system/dispatch_daemon/index.js
View file @
d72633d3
...
...
@@ -9,6 +9,7 @@ const {spawn } = require('child_process')
const
execute
=
require
(
'
./execute
'
)
const
fs
=
require
(
'
fs
'
)
const
fetch
=
require
(
'
node-fetch
'
);
const
os
=
require
(
'
os
'
);
let
metadataDB
=
`http://
${
secrets
.
couchdb_username
}
:
${
secrets
.
couchdb_password
}
@
${
constants
.
couchdb_host
}
`
metadataDB
=
metadataDB
+
"
/
"
+
constants
.
function_db_name
+
"
/
"
...
...
@@ -37,7 +38,7 @@ libSupport.makeTopic(node_id).then(() => {
{
autoCommit
:
true
}
])
consumer
.
on
(
'
message
'
,
function
(
message
)
{
logger
.
info
(
message
);
//
logger.info(message);
let
topic
=
message
.
topic
message
=
message
.
value
message
=
JSON
.
parse
(
message
)
...
...
@@ -83,12 +84,12 @@ libSupport.download(constants.grunt_host, "grunt", false).then(() => {
logger
.
info
(
"
grunt made executable. Starting grunt
"
)
let
grunt
=
spawn
(
'
./grunt
'
,
[
node_id
])
grunt
.
stdout
.
on
(
'
data
'
,
data
=>
{
logger
.
info
(
data
.
toString
());
//
logger.info(data.toString());
})
grunt
.
stderr
.
on
(
'
data
'
,
data
=>
{
logger
.
info
(
data
.
toString
());
//
logger.info(data.toString());
})
grunt
.
on
(
'
close
'
,
(
code
)
=>
{
...
...
@@ -154,9 +155,19 @@ function startWorker(local_repository, producer, metadata) {
}
function
heartbeat
()
{
let
info
=
{
free_mem
:
os
.
freemem
(),
cpu_count
:
os
.
cpus
().
length
,
total_mem
:
os
.
totalmem
(),
avg_load
:
os
.
loadavg
()
}
let
payload
=
[{
topic
:
"
heartbeat
"
,
messages
:
JSON
.
stringify
({
"
address
"
:
node_id
,
"
timestamp
"
:
Date
.
now
()})
messages
:
JSON
.
stringify
({
"
address
"
:
node_id
,
"
system_info
"
:
info
,
"
timestamp
"
:
Date
.
now
()
})
}]
producer
.
send
(
payload
,
function
(
cb
)
{})
}
...
...
dispatch_system/dispatch_manager/repository/worker_env/envTest.js
View file @
d72633d3
'
use strict
'
;
const
express
=
require
(
'
express
'
)
const
fileUpload
=
require
(
'
express-fileupload
'
);
let
request
=
require
(
'
request
'
)
const
process
=
require
(
'
process
'
)
...
...
@@ -25,11 +26,10 @@ let kafka = require('kafka-node'),
app
.
use
(
express
.
json
());
app
.
use
(
express
.
urlencoded
({
extended
:
true
}));
app
.
use
(
fileUpload
())
let
lastRequest
=
Date
.
now
(),
totalRequest
=
0
app
.
post
(
'
/serverless/function/execute/
'
,
(
req
,
res
)
=>
{
console
.
log
(
"
asd
"
);
if
(
flagFirstRequest
)
{
waitTime
=
Date
.
now
()
-
waitTime
flagFirstRequest
=
false
...
...
@@ -56,7 +56,7 @@ app.post('/serverless/function/execute/', (req, res) => {
app
.
post
(
'
/serverless/function/timeout
'
,
(
req
,
res
)
=>
{
console
.
log
(
req
.
body
);
let
idleTime
=
req
.
body
.
timeout
let
idleTime
=
parseInt
(
req
.
body
.
timeout
)
console
.
log
(
"
Idle time set to:
"
,
idleTime
);
res
.
json
({
status
:
"
success
"
...
...
@@ -65,7 +65,6 @@ app.post('/serverless/function/timeout', (req, res) => {
async
function
executor
(
payload
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
resolve
({})
})
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment