-
Notifications
You must be signed in to change notification settings - Fork 3
/
controlwrap.js
33 lines (30 loc) · 1.28 KB
/
controlwrap.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
const happensBeforeInfoUtil = require('../hb/util');
const logUtil = require('../logger/util');
const Random1Strategy = require('./strategies/random1');
const OnePostponeWithHistoryStrategy = require('./strategies/onePostpone');
const NoPostponeStrategy = require('./strategies/noPostpone');
const NoHbRandomStrategy = require('./strategies/noHbRandom');
const sw = require('spawn-wrap');
let hbi = happensBeforeInfoUtil.read(process.env.hbfile);
//try to find settings.json in the same folder of the hb file
let config = logUtil.retrieveConfigIfExists(process.env.hbfile);
//
let strategy;
switch (process.env.strategy) {
case 'random':
strategy = new Random1Strategy(hbi, process.env.run, process.env.logDir, config);
break;
case 'noPostpone':
strategy = new NoPostponeStrategy(hbi, process.env.run, process.env.logDir, config);
break;
case '1-postpone-history':
strategy = new OnePostponeWithHistoryStrategy(hbi, process.env.run, process.env.logDir, config);
strategy.setMemoryPath(process.env.memory);
break;
case 'noHbRandom':
strategy = new NoHbRandomStrategy(hbi, process.env.run, process.env.logDir, config);
break;
}
strategy.install();
process.on('exit', () => { strategy.register.dump(); });
sw.runMain();