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
f7a0de90
Commit
f7a0de90
authored
Jan 30, 2020
by
nilanjandaw
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://git.cse.iitb.ac.in/nilanjandaw/serverless-hybrid-workload
parents
66a27d36
bf332d2a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
dispatcher/index.js
dispatcher/index.js
+7
-6
No files found.
dispatcher/index.js
View file @
f7a0de90
...
@@ -14,7 +14,7 @@ const libSupport = require('./lib')
...
@@ -14,7 +14,7 @@ const libSupport = require('./lib')
let
db
=
new
Map
()
let
db
=
new
Map
()
app
.
use
(
morgan
(
'
combined
'
))
app
.
use
(
morgan
(
'
combined
'
))
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
fals
e
}))
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
tru
e
}))
app
.
use
(
bodyParser
.
json
())
app
.
use
(
bodyParser
.
json
())
const
file_path
=
__dirname
+
"
/repository/
"
const
file_path
=
__dirname
+
"
/repository/
"
...
@@ -137,10 +137,11 @@ function dispatch() {
...
@@ -137,10 +137,11 @@ function dispatch() {
let
lookbackWindow
=
Math
.
min
(
WINDOW_SIZE
,
requestQueue
.
length
)
let
lookbackWindow
=
Math
.
min
(
WINDOW_SIZE
,
requestQueue
.
length
)
for
(
let
i
=
0
;
i
<
lookbackWindow
;
i
++
)
{
for
(
let
i
=
0
;
i
<
lookbackWindow
;
i
++
)
{
let
{
req
,
res
}
=
requestQueue
.
shift
()
let
{
req
,
res
}
=
requestQueue
.
shift
()
console
.
log
(
req
.
body
)
let
runtime
=
req
.
body
.
runtime
let
runtime
=
req
.
body
.
runtime
let
functionHash
=
req
.
params
.
id
let
functionHash
=
req
.
params
.
id
let
function_id
=
libSupport
.
makeid
(
20
)
let
function_id
=
libSupport
.
makeid
(
20
)
console
.
log
(
"
Dispatching function with Id
"
,
function_id
);
console
.
log
(
"
Dispatching function with Id
"
,
function_id
,
runtime
);
let
node_id
=
getAddress
()
let
node_id
=
getAddress
()
client
.
publish
(
node_id
,
JSON
.
stringify
({
client
.
publish
(
node_id
,
JSON
.
stringify
({
"
type
"
:
"
execute
"
,
"
type
"
:
"
execute
"
,
...
@@ -170,10 +171,10 @@ client.on('message', function (topic, message) {
...
@@ -170,10 +171,10 @@ client.on('message', function (topic, message) {
db
.
delete
(
message
.
function_id
)
db
.
delete
(
message
.
function_id
)
}
else
if
(
topic
===
"
heartbeat
"
)
{
}
else
if
(
topic
===
"
heartbeat
"
)
{
message
=
JSON
.
parse
(
message
)
message
=
JSON
.
parse
(
message
)
if
(
workerNodes
.
indexOf
(
message
.
address
)
===
-
1
)
if
(
workerNodes
.
indexOf
(
message
.
address
)
===
-
1
)
{
workerNodes
.
push
(
message
.
address
)
workerNodes
.
push
(
message
.
address
)
console
.
log
(
workerNodes
);
console
.
log
(
workerNodes
);
}
}
}
})
})
...
@@ -184,4 +185,4 @@ client.on('connect', function () {
...
@@ -184,4 +185,4 @@ client.on('connect', function () {
client
.
subscribe
(
"
heartbeat
"
)
client
.
subscribe
(
"
heartbeat
"
)
})
})
setInterval
(
dispatch
,
1000
);
setInterval
(
dispatch
,
1000
);
\ No newline at end of file
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