From 3f2d0afcac1aa4401214bd032d51b49aad1f6dfe Mon Sep 17 00:00:00 2001 From: Daniel Patterson Date: Fri, 2 Feb 2018 11:22:14 -0800 Subject: [PATCH] Use VALHALLA_HOME to find valhalla tools. Disable heirarchy calculation to speed up pre-processing. --- features/lib/osrm_loader.js | 2 +- features/support/data.js | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/features/lib/osrm_loader.js b/features/lib/osrm_loader.js index e1db7803e..080356806 100644 --- a/features/lib/osrm_loader.js +++ b/features/lib/osrm_loader.js @@ -105,7 +105,7 @@ class ValhallaDirectLoader extends OSRMBaseLoader { if (this.osrmIsRunning()) return callback(new Error("osrm-routed already running!")); var args = [this.inputFile, '1']; - this.child = child_process.execFile('/Users/danpat/mapbox/valhalla/valhalla_service', args, this.scope.environment, (err) => { + this.child = child_process.execFile(`${process.env.VALHALLA_HOME}/valhalla_service`, args, this.scope.environment, (err) => { if (err && err.signal !== 'SIGINT') { this.child = null; throw new Error(util.format('valhalla_service %s: %s', errorReason(err), err.cmd)); diff --git a/features/support/data.js b/features/support/data.js index 233bd1394..f4a814561 100644 --- a/features/support/data.js +++ b/features/support/data.js @@ -265,9 +265,12 @@ module.exports = function () { `--mjolnir-timezone`, `${p.inputCacheDir}/${p.scenarioID}_valhalla_tiles/timezones.sqlite`, `--mjolnir-admin`, `${p.inputCacheDir}/${p.scenarioID}_valhalla_tiles/admins.sqlite`]; - child_process.execFile('/Users/danpat/mapbox/valhalla/scripts/valhalla_build_config', params, {}, (error, stdout, stderr) => { + child_process.execFile(`${process.env.VALHALLA_HOME}/scripts/valhalla_build_config`, params, {}, (error, stdout, stderr) => { if (error) { throw error; } - fs.writeFile(`${p.inputCacheDir}/${p.scenarioID}_valhalla_config.json`, stdout, (err) => { + // Disable heirarchy calculation - it's slow, and not needed for small tests. + var config = JSON.parse(stdout); + config.mjolnir.hierarchy = false; + fs.writeFile(`${p.inputCacheDir}/${p.scenarioID}_valhalla_config.json`, JSON.stringify(config), (err) => { if (err) throw err; fs.writeFile(stamp, 'ok', callback); }) @@ -283,7 +286,7 @@ module.exports = function () { var params = [`-c`,`${p.inputCacheDir}/${p.scenarioID}_valhalla_config.json`, `${p.inputCacheFilePBF}`]; - child_process.execFile('/Users/danpat/mapbox/valhalla/valhalla_build_tiles', params, {}, (error, stdout, stderr) => { + child_process.execFile(`${process.env.VALHALLA_HOME}/valhalla_build_tiles`, params, {}, (error, stdout, stderr) => { if (error) { throw error; } console.log(stdout); console.log(stderr);