4 let BuildbotTriggerable = require('./js/buildbot-triggerable.js').BuildbotTriggerable;
5 let RemoteAPI = require('./js/remote.js').RemoteAPI;
6 let fs = require('fs');
7 let parseArguments = require('./js/parse-arguments.js').parseArguments;
11 let options = parseArguments(argv, [
12 {name: '--server-config-json', required: true},
13 {name: '--buildbot-config-json', required: true},
14 {name: '--seconds-to-sleep', type: parseFloat, default: 120},
22 function syncLoop(options)
24 // FIXME: Fix Manifest.fetch() to use ensureSingleton to create model objects.
25 global.AnalysisTask._fetchAllPromise = null;
26 global.AnalysisTask.clearStaticMap();
27 global.BuildRequest.clearStaticMap();
28 global.CommitLog.clearStaticMap();
29 global.Metric.clearStaticMap();
30 global.Platform.clearStaticMap();
31 global.Repository.clearStaticMap();
32 global.RootSet.clearStaticMap();
33 global.Test.clearStaticMap();
34 global.TestGroup.clearStaticMap();
36 let serverConfig = JSON.parse(fs.readFileSync(options['--server-config-json'], 'utf8'));
37 let buildbotConfig = JSON.parse(fs.readFileSync(options['--buildbot-config-json'], 'utf8'));
38 let buildbotRemote = new RemoteAPI(buildbotConfig.server);
40 // v3 models use the global RemoteAPI to access the perf dashboard.
41 global.RemoteAPI = new RemoteAPI(serverConfig.server);
43 console.log(`Fetching the manifest...`);
44 Manifest.fetch().then(function () {
45 let triggerable = new BuildbotTriggerable(buildbotConfig, global.RemoteAPI, buildbotRemote, serverConfig.slave, console);
46 return triggerable.syncOnce();
47 }).catch(function (error) {
49 if (typeof(error.stack) == 'string') {
50 for (let line of error.stack.split('\n'))
54 setTimeout(syncLoop.bind(global, options), options['--seconds-to-sleep'] * 1000);