-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
75 lines (68 loc) · 1.37 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
var Fs = require("fs");
var Straw = require("straw");
var progressFile = __dirname + "/progress.txt";
var last_updated_at = Fs.existsSync(progressFile) ? parseInt(Fs.readFileSync(progressFile, "utf8"), 10) : 0;
var redis = {
host: 'localhost',
port: 6379,
};
var topo = Straw.create({
nodes_dir: __dirname + '/nodes',
redis: redis,
});
topo.add([{
id: "pull-plunks",
node: "pull-plunks",
outputs: {
'plunk-old': "plunk-old",
},
config: {
last_updated_at: last_updated_at,
mongoUrl: process.env.MONGO_URL,
},
}, {
id: "plunk-parse",
node: "plunk-parse",
input: "plunk-old",
outputs: {
'object': "object",
'package-usage': "package-usage",
'plunk-new': "plunk-new",
},
}, {
id: "plunk-index",
node: "plunk-index",
input: "plunk-new",
output: "plunk-indexed",
config: {
index: "plunker",
type: "plunk",
},
}, {
id: "object-save",
node: "object-save",
input: "object",
config: {
leveldb: __dirname + "/objects",
},
}, {
id: "progress-save",
node: "progress-save",
input: "plunk-indexed",
output: "plunk-id",
config: {
progressFile: progressFile,
},
}, {
id: "track-speed",
node: "track-speed",
input: "plunk-id",
}], function () {
console.log("Starting topology");
topo.start();
});
process.on( 'SIGINT', function() {
topo.destroy(function(){
console.log( 'Finished.' );
});
});