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
7fbb2e90
Commit
7fbb2e90
authored
Apr 08, 2020
by
Nilanjan Daw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
streamlined various shared data
parent
8aec2c81
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
40 deletions
+59
-40
dispatch_system/constants.json
dispatch_system/constants.json
+5
-3
dispatch_system/dispatch_manager/explicit_chain_handler.js
dispatch_system/dispatch_manager/explicit_chain_handler.js
+8
-15
dispatch_system/dispatch_manager/index.js
dispatch_system/dispatch_manager/index.js
+13
-19
dispatch_system/dispatch_manager/lib.js
dispatch_system/dispatch_manager/lib.js
+3
-3
dispatch_system/dispatch_manager/shared_meta.js
dispatch_system/dispatch_manager/shared_meta.js
+30
-0
No files found.
dispatch_system/constants.json
View file @
7fbb2e90
...
@@ -4,9 +4,11 @@
...
@@ -4,9 +4,11 @@
"master_address"
:
"localhost"
,
"master_address"
:
"localhost"
,
"grunt_host"
:
"https://www.namandixit.net/lovecraftian_nightmares/grunt"
,
"grunt_host"
:
"https://www.namandixit.net/lovecraftian_nightmares/grunt"
,
"couchdb_host"
:
"localhost:5984"
,
"couchdb_host"
:
"localhost:5984"
,
"function_db_name"
:
"serverless"
,
"db"
:
{
"metrics_db_name"
:
"metrics"
,
"function_meta"
:
"serverless"
,
"implicit_chain_db_name"
:
"implicit_chain"
,
"metrics"
:
"metrics"
,
"implicit_chain_meta"
:
"implicit_chain"
},
"network"
:
{
"network"
:
{
"network_bridge"
:
"hybrid_kafka-serverless"
,
"network_bridge"
:
"hybrid_kafka-serverless"
,
"internal"
:
{
"internal"
:
{
...
...
dispatch_system/dispatch_manager/explicit_chain_handler.js
View file @
7fbb2e90
...
@@ -6,22 +6,18 @@ const fs = require('fs')
...
@@ -6,22 +6,18 @@ const fs = require('fs')
const
{
spawn
}
=
require
(
'
child_process
'
)
const
{
spawn
}
=
require
(
'
child_process
'
)
const
fetch
=
require
(
'
node-fetch
'
)
const
fetch
=
require
(
'
node-fetch
'
)
const
constants
=
require
(
'
../constants.json
'
)
const
constants
=
require
(
'
../constants.json
'
)
const
secrets
=
require
(
'
./secrets.json
'
)
const
operator
=
require
(
'
./operator
'
)
const
operator
=
require
(
'
./operator
'
)
const
sharedStructures
=
require
(
'
./shared_structures
'
)
const
sharedMeta
=
require
(
'
./shared_meta
'
)
let
metadataDB
=
`http://
${
secrets
.
couchdb_username
}
:
${
secrets
.
couchdb_password
}
@
${
constants
.
couchdb_host
}
`
metadataDB
=
metadataDB
+
"
/
"
+
constants
.
function_db_name
+
"
/
"
let
metricsDB
=
`http://
${
secrets
.
couchdb_username
}
:
${
secrets
.
couchdb_password
}
@
${
constants
.
couchdb_host
}
`
metricsDB
=
metricsDB
+
"
/
"
+
constants
.
metrics_db_name
+
"
/
"
const
logger
=
libSupport
.
logger
const
logger
=
libSupport
.
logger
const
registry_url
=
constants
.
registry_url
const
registry_url
=
constants
.
registry_url
let
functionToResource
=
sharedStructures
.
functionToResource
,
let
functionToResource
=
sharedMeta
.
functionToResource
,
db
=
sharedStructures
.
db
,
db
=
sharedMeta
.
db
,
conditionProbabilityExpilict
=
sharedStructures
.
conditionProbabilityExpilict
conditionProbabilityExpilict
=
sharedMeta
.
conditionProbabilityExpilict
,
metricsDB
=
sharedMeta
.
metricsDB
,
metadataDB
=
sharedMeta
.
metadataDB
router
.
post
(
'
/deploy
'
,
(
req
,
res
)
=>
{
router
.
post
(
'
/deploy
'
,
(
req
,
res
)
=>
{
...
@@ -478,10 +474,7 @@ function createDirectory(path) {
...
@@ -478,10 +474,7 @@ function createDirectory(path) {
})
})
}
}
function
initialise
(
functionToResource
)
{
this
.
functionToResource
=
functionToResource
}
module
.
exports
=
{
module
.
exports
=
{
router
,
initialise
router
}
}
dispatch_system/dispatch_manager/index.js
View file @
7fbb2e90
...
@@ -10,19 +10,11 @@ const { spawn } = require('child_process');
...
@@ -10,19 +10,11 @@ const { spawn } = require('child_process');
const
morgan
=
require
(
'
morgan
'
);
const
morgan
=
require
(
'
morgan
'
);
const
heap
=
require
(
'
heap
'
);
const
heap
=
require
(
'
heap
'
);
const
fetch
=
require
(
'
node-fetch
'
);
const
fetch
=
require
(
'
node-fetch
'
);
const
swStats
=
require
(
'
swagger-stats
'
);
//
const swStats = require('swagger-stats');
const
apiSpec
=
require
(
'
./swagger.json
'
);
//
const apiSpec = require('./swagger.json');
const
util
=
require
(
'
util
'
)
const
util
=
require
(
'
util
'
)
const
shared
Structures
=
require
(
'
./shared_structures
'
)
const
shared
Meta
=
require
(
'
./shared_meta
'
)
/**
* URL to the couchdb database server used to store function metadata
*/
let
metadataDB
=
`http://
${
secrets
.
couchdb_username
}
:
${
secrets
.
couchdb_password
}
@
${
constants
.
couchdb_host
}
`
metadataDB
=
metadataDB
+
"
/
"
+
constants
.
function_db_name
+
"
/
"
let
metricsDB
=
`http://
${
secrets
.
couchdb_username
}
:
${
secrets
.
couchdb_password
}
@
${
constants
.
couchdb_host
}
`
metricsDB
=
metricsDB
+
"
/
"
+
constants
.
metrics_db_name
+
"
/
"
const
app
=
express
()
const
app
=
express
()
const
libSupport
=
require
(
'
./lib
'
)
const
libSupport
=
require
(
'
./lib
'
)
...
@@ -31,14 +23,16 @@ let date = new Date();
...
@@ -31,14 +23,16 @@ let date = new Date();
let
log_channel
=
constants
.
topics
.
log_channel
let
log_channel
=
constants
.
topics
.
log_channel
let
usedPort
=
new
Map
(),
// TODO: remove after integration with RM
let
usedPort
=
new
Map
(),
// TODO: remove after integration with RM
db
=
shared
Structures
.
db
,
// queue holding request to be dispatched
db
=
shared
Meta
.
db
,
// queue holding request to be dispatched
resourceMap
=
shared
Structures
.
resourceMap
,
// map between resource_id and resource details like node_id, port, associated function etc
resourceMap
=
shared
Meta
.
resourceMap
,
// map between resource_id and resource details like node_id, port, associated function etc
functionToResource
=
shared
Structures
.
functionToResource
,
// a function to resource map. Each map contains a minheap of
functionToResource
=
shared
Meta
.
functionToResource
,
// a function to resource map. Each map contains a minheap of
// resources associated with the function
// resources associated with the function
workerNodes
=
sharedStructures
.
workerNodes
,
// list of worker nodes currently known to the DM
workerNodes
=
sharedMeta
.
workerNodes
,
// list of worker nodes currently known to the DM
functionBranchTree
=
sharedStructures
.
functionBranchTree
// a tree to store function branch predictions
functionBranchTree
=
sharedMeta
.
functionBranchTree
,
// a tree to store function branch predictions
metricsDB
=
sharedMeta
.
metricsDB
,
metadataDB
=
sharedMeta
.
metadataDB
chainHandler
.
initialise
(
functionToResource
)
let
kafka
=
require
(
'
kafka-node
'
),
let
kafka
=
require
(
'
kafka-node
'
),
Producer
=
kafka
.
Producer
,
Producer
=
kafka
.
Producer
,
client
=
new
kafka
.
KafkaClient
({
client
=
new
kafka
.
KafkaClient
({
...
@@ -67,7 +61,7 @@ app.use(express.urlencoded({ extended: true }));
...
@@ -67,7 +61,7 @@ app.use(express.urlencoded({ extended: true }));
const
file_path
=
__dirname
+
"
/repository/
"
const
file_path
=
__dirname
+
"
/repository/
"
app
.
use
(
'
/repository
'
,
express
.
static
(
file_path
));
// file server hosting deployed functions
app
.
use
(
'
/repository
'
,
express
.
static
(
file_path
));
// file server hosting deployed functions
app
.
use
(
fileUpload
())
app
.
use
(
fileUpload
())
app
.
use
(
swStats
.
getMiddleware
({
swaggerSpec
:
apiSpec
}));
// statistics middleware
//
app.use(swStats.getMiddleware({ swaggerSpec: apiSpec })); // statistics middleware
app
.
use
(
'
/serverless/chain
'
,
chainHandler
.
router
);
// chain router (explicit_chain_handler.js) for handling explicit chains
app
.
use
(
'
/serverless/chain
'
,
chainHandler
.
router
);
// chain router (explicit_chain_handler.js) for handling explicit chains
let
requestQueue
=
[]
let
requestQueue
=
[]
...
...
dispatch_system/dispatch_manager/lib.js
View file @
7fbb2e90
...
@@ -6,10 +6,11 @@ const winston = require('winston')
...
@@ -6,10 +6,11 @@ const winston = require('winston')
const
constants
=
require
(
'
.././constants.json
'
)
const
constants
=
require
(
'
.././constants.json
'
)
const
secrets
=
require
(
'
./secrets.json
'
)
const
secrets
=
require
(
'
./secrets.json
'
)
const
metrics
=
require
(
'
./metrics
'
)
const
metrics
=
require
(
'
./metrics
'
)
const
sharedMeta
=
require
(
'
./shared_meta
'
)
const
{
createLogger
,
format
,
transports
}
=
winston
;
const
{
createLogger
,
format
,
transports
}
=
winston
;
const
heap
=
require
(
'
heap
'
)
const
heap
=
require
(
'
heap
'
)
let
implicitChainDB
=
sharedMeta
.
implicitChainDB
let
kafka
=
require
(
'
kafka-node
'
),
let
kafka
=
require
(
'
kafka-node
'
),
Producer
=
kafka
.
Producer
,
Producer
=
kafka
.
Producer
,
client
=
new
kafka
.
KafkaClient
({
client
=
new
kafka
.
KafkaClient
({
...
@@ -18,8 +19,7 @@ let kafka = require('kafka-node'),
...
@@ -18,8 +19,7 @@ let kafka = require('kafka-node'),
}),
}),
producer
=
new
Producer
(
client
)
producer
=
new
Producer
(
client
)
let
implicitChainDB
=
`http://
${
secrets
.
couchdb_username
}
:
${
secrets
.
couchdb_password
}
@
${
constants
.
couchdb_host
}
`
implicitChainDB
=
implicitChainDB
+
"
/
"
+
constants
.
implicit_chain_db_names
+
"
/
"
/**
/**
* Generates unique IDs of arbitrary length
* Generates unique IDs of arbitrary length
...
...
dispatch_system/dispatch_manager/shared_
structures
.js
→
dispatch_system/dispatch_manager/shared_
meta
.js
View file @
7fbb2e90
const
secrets
=
require
(
'
./secrets.json
'
)
const
constants
=
require
(
'
.././constants.json
'
)
let
db
=
new
Map
(),
// queue holding request to be dispatched
let
db
=
new
Map
(),
// queue holding request to be dispatched
resourceMap
=
new
Map
(),
// map between resource_id and resource details like node_id, port, associated function etc
resourceMap
=
new
Map
(),
// map between resource_id and resource details like node_id, port, associated function etc
functionToResource
=
new
Map
(),
// a function to resource map. Each map contains a minheap of
functionToResource
=
new
Map
(),
// a function to resource map. Each map contains a minheap of
...
@@ -6,8 +9,22 @@ let db = new Map(), // queue holding request to be dispatched
...
@@ -6,8 +9,22 @@ let db = new Map(), // queue holding request to be dispatched
functionBranchTree
=
new
Map
(),
// a tree to store function branch predictions
functionBranchTree
=
new
Map
(),
// a tree to store function branch predictions
conditionProbabilityExpilict
=
new
Map
()
// tree holding conditional probabilities for explicit chains
conditionProbabilityExpilict
=
new
Map
()
// tree holding conditional probabilities for explicit chains
/**
* URL to the couchdb database server used to store data
*/
let
metadataDB
=
`http://
${
secrets
.
couchdb_username
}
:
${
secrets
.
couchdb_password
}
@
${
constants
.
couchdb_host
}
`
metadataDB
=
metadataDB
+
"
/
"
+
constants
.
db
.
function_meta
+
"
/
"
let
metricsDB
=
`http://
${
secrets
.
couchdb_username
}
:
${
secrets
.
couchdb_password
}
@
${
constants
.
couchdb_host
}
`
metricsDB
=
metricsDB
+
"
/
"
+
constants
.
db
.
metrics
+
"
/
"
let
implicitChainDB
=
`http://
${
secrets
.
couchdb_username
}
:
${
secrets
.
couchdb_password
}
@
${
constants
.
couchdb_host
}
`
implicitChainDB
=
implicitChainDB
+
"
/
"
+
constants
.
db
.
implicit_chain_meta
+
"
/
"
module
.
exports
=
{
module
.
exports
=
{
db
,
functionBranchTree
,
functionToResource
,
workerNodes
,
resourceMap
,
db
,
functionBranchTree
,
functionToResource
,
workerNodes
,
resourceMap
,
conditionProbabilityExpilict
conditionProbabilityExpilict
,
metadataDB
,
metricsDB
,
implicitChainDB
}
}
\ 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