Avoid doubled reprocessing for scenarios without caching
This commit is contained in:
parent
9a85a50586
commit
da15c014f5
@ -265,7 +265,7 @@ module.exports = function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.Given(/^the data has been saved to disk$/, (callback) => {
|
this.Given(/^the data has been saved to disk$/, (callback) => {
|
||||||
this.reprocess(callback);
|
this.writeAndLinkOSM(callback);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.Given(/^the data has been extracted$/, (callback) => {
|
this.Given(/^the data has been extracted$/, (callback) => {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
var assert = require('assert');
|
'use strict';
|
||||||
var fs = require('fs');
|
|
||||||
|
const assert = require('assert');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
module.exports = function () {
|
module.exports = function () {
|
||||||
this.resetOptionsOutput = () => {
|
this.resetOptionsOutput = () => {
|
||||||
@ -24,11 +26,19 @@ module.exports = function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.When(/^I run "osrm\-extract\s?(.*?)"$/, (options, callback) => {
|
this.When(/^I run "osrm\-extract\s?(.*?)"$/, (options, callback) => {
|
||||||
this.runAndSafeOutput('osrm-extract', options, callback);
|
const stamp = this.processedCacheFile + '.extract';
|
||||||
|
this.runAndSafeOutput('osrm-extract', options, (err) => {
|
||||||
|
if (err) return callback(err);
|
||||||
|
fs.writeFile(stamp, 'ok', callback);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.When(/^I run "osrm\-contract\s?(.*?)"$/, (options, callback) => {
|
this.When(/^I run "osrm\-contract\s?(.*?)"$/, (options, callback) => {
|
||||||
this.runAndSafeOutput('osrm-contract', options, callback);
|
const stamp = this.processedCacheFile + '.contract';
|
||||||
|
this.runAndSafeOutput('osrm-contract', options, (err) => {
|
||||||
|
if (err) return callback(err);
|
||||||
|
fs.writeFile(stamp, 'ok', callback);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.When(/^I try to run "osrm\-routed\s?(.*?)"$/, (options, callback) => {
|
this.When(/^I try to run "osrm\-routed\s?(.*?)"$/, (options, callback) => {
|
||||||
@ -65,12 +75,12 @@ module.exports = function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.Then(/^stdout should contain \/(.*)\/$/, (regexStr) => {
|
this.Then(/^stdout should contain \/(.*)\/$/, (regexStr) => {
|
||||||
var re = new RegExp(regexStr);
|
const re = new RegExp(regexStr);
|
||||||
assert.ok(this.stdout.match(re));
|
assert.ok(this.stdout.match(re));
|
||||||
});
|
});
|
||||||
|
|
||||||
this.Then(/^stderr should contain \/(.*)\/$/, (regexStr) => {
|
this.Then(/^stderr should contain \/(.*)\/$/, (regexStr) => {
|
||||||
var re = new RegExp(regexStr);
|
const re = new RegExp(regexStr);
|
||||||
assert.ok(this.stdout.match(re));
|
assert.ok(this.stdout.match(re));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -91,7 +101,7 @@ module.exports = function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.Then(/^datasource names should contain "(.+)"$/, (expectedData) => {
|
this.Then(/^datasource names should contain "(.+)"$/, (expectedData) => {
|
||||||
var actualData = fs.readFileSync(this.processedCacheFile + '.datasource_names', {encoding:'UTF-8'}).trim().split('\n').join(',');
|
const actualData = fs.readFileSync(this.processedCacheFile + '.datasource_names', {encoding:'UTF-8'}).trim().split('\n').join(',');
|
||||||
assert.equal(actualData, expectedData);
|
assert.equal(actualData, expectedData);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -204,18 +204,23 @@ module.exports = function () {
|
|||||||
queue.awaitAll(callback);
|
queue.awaitAll(callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.reprocess = (callback) => {
|
this.writeAndLinkOSM = (callback) => {
|
||||||
let queue = d3.queue(1);
|
let queue = d3.queue(1);
|
||||||
queue.defer(this.writeOSM.bind(this));
|
queue.defer(this.writeOSM.bind(this));
|
||||||
queue.defer(this.linkOSM.bind(this));
|
queue.defer(this.linkOSM.bind(this));
|
||||||
|
queue.awaitAll(callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.reprocess = (callback) => {
|
||||||
|
let queue = d3.queue(1);
|
||||||
|
queue.defer(this.writeAndLinkOSM.bind(this));
|
||||||
queue.defer(this.extractAndContract.bind(this));
|
queue.defer(this.extractAndContract.bind(this));
|
||||||
queue.awaitAll(callback);
|
queue.awaitAll(callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.reprocessAndLoadData = (callback) => {
|
this.reprocessAndLoadData = (callback) => {
|
||||||
let queue = d3.queue(1);
|
let queue = d3.queue(1);
|
||||||
queue.defer(this.writeOSM.bind(this));
|
queue.defer(this.writeAndLinkOSM.bind(this));
|
||||||
queue.defer(this.linkOSM.bind(this));
|
|
||||||
queue.defer(this.extractAndContract.bind(this));
|
queue.defer(this.extractAndContract.bind(this));
|
||||||
queue.defer(this.osrmLoader.load.bind(this.osrmLoader), this.processedCacheFile);
|
queue.defer(this.osrmLoader.load.bind(this.osrmLoader), this.processedCacheFile);
|
||||||
queue.awaitAll(callback);
|
queue.awaitAll(callback);
|
||||||
|
Loading…
Reference in New Issue
Block a user