forked from RackHD/on-taskgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
53 lines (47 loc) · 1.53 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
// Copyright 2015, EMC, Inc.
/* jshint: node:true */
'use strict';
var di = require('di'),
_ = require('lodash'),
core = require('on-core')(di),
tasks = require('on-tasks'),
injector = new di.Injector(
_.flatten([
core.injectables,
tasks.injectables,
require('./lib/task-graph'),
require('./lib/task-graph-runner'),
require('./lib/task-graph-subscriptions'),
require('./lib/loader'),
require('./lib/scheduler'),
require('./lib/registry'),
require('./lib/service-graph'),
require('./lib/stores/memory'),
require('./lib/stores/waterline')
])
),
taskGraphRunner = injector.get('TaskGraph.Runner'),
logger = injector.get('Logger').initialize('TaskGraph');
taskGraphRunner.start()
.then(function () {
logger.info('Task Graph Runner Started.');
})
.catch(function(error) {
console.error(error.message || error.details);
console.error(error.stack || error.rawStack);
// logger.error('Task Graph Runner Startup Error.', { error: error });
process.nextTick(function() {
process.exit(1);
});
});
process.on('SIGINT', function() {
taskGraphRunner.stop()
.catch(function(error) {
logger.error('Task Graph Runner Shutdown Error.', { error: error });
})
.finally(function() {
process.nextTick(function() {
process.exit(1);
});
});
});