Commit 9d97bdfa authored by Nilanjan Daw's avatar Nilanjan Daw

Minor bug fixed

Fixed minor bugs introduced due to code streamlining
parent 8a98481f
...@@ -4,5 +4,4 @@ node_modules ...@@ -4,5 +4,4 @@ node_modules
package-lock.json package-lock.json
firecracker* firecracker*
secrets.json secrets.json
resource_manager/bin/** resource_manager/bin/**
\ No newline at end of file
{"id":"192.168.31.51","master_node":"10.129.6.5"} {"id":"192.168.1.103","master_node":"10.129.6.5"}
\ No newline at end of file \ No newline at end of file
...@@ -41,7 +41,7 @@ libSupport.makeTopic(node_id).then(() => { ...@@ -41,7 +41,7 @@ libSupport.makeTopic(node_id).then(() => {
if (message.type === "execute") { if (message.type === "execute") {
console.log("function_id", function_id); console.log("function_id", function_id);
libSupport.download(host_url + "/repository/" + functionHash, local_repository + functionHash).then(() => { libSupport.download(host_url + "/repository/" + functionHash, local_repository + functionHash).then(() => {
startWorker(local_repository, functionHash, producer, runtime) startWorker(local_repository, functionHash, function_id, producer, runtime)
}) })
} }
...@@ -51,7 +51,7 @@ libSupport.makeTopic(node_id).then(() => { ...@@ -51,7 +51,7 @@ libSupport.makeTopic(node_id).then(() => {
}) })
function startWorker(local_repository, functionHash, producer, runtime) { function startWorker(local_repository, functionHash,function_id, producer, runtime) {
if (runtime === "isolate") if (runtime === "isolate")
execute.runIsolate(local_repository + functionHash).then(result => { execute.runIsolate(local_repository + functionHash).then(result => {
producer.send([{ producer.send([{
......
...@@ -46,7 +46,7 @@ function makeTopic(id) { ...@@ -46,7 +46,7 @@ function makeTopic(id) {
var download = function (url, dest, cb) { var download = function (url, dest, cb) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
console.log(url); console.log(url);
if (!fs.existsSync(local_repository + functionHash)) { if (!fs.existsSync(dest)) {
var file = fs.createWriteStream(dest); var file = fs.createWriteStream(dest);
var request = http.get(url, function (response) { var request = http.get(url, function (response) {
response.pipe(file); response.pipe(file);
......
...@@ -222,6 +222,7 @@ consumer.on('message', function (message) { ...@@ -222,6 +222,7 @@ consumer.on('message', function (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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment