function doTask(date) { const env = {DATE: date} console.log('DATE=', date) const p1 = exec('node reduce.js', {env: env}, (err) => { assert.ifError(err) const p2 = exec('indexer -c sphinx.conf hash_delta --rotate', {env: env}, (err) => { assert.ifError(err) const p3 = exec('indexer -c sphinx.conf --merge hash hash_delta --rotate', (err) => { assert.ifError(err) console.log(new Date(), date, 'task done') }) p3.stdout.pipe(process.stdout) }) p2.stdout.pipe(process.stdout) }) p1.stdout.pipe(process.stdout) }
/** * Iterates over requests asynchronously * * @param {function} iterator - iterator function */ function iterateRequests(iterator) { asynckit.serial(common.requests, iterator, function noop(err){ assert.ifError(err, 'expects all requests to finish without errors'); }); }
store.on('error', function(error) { assert.ifError(error); assert.ok(false); });
/** * Iterates over sendings asynchronously * * @param {function} iterator - iterator function */ function iterateSendings(iterator) { asynckit.serial(common.sendings, function(item, type, callback) { // each item is an array by itself asynckit.serial(item, function(test, id, cb) { // differentiate elements within same type iterator(test, type + '-' + id, cb); }, callback); }, function noop(err){ assert.ifError(err, 'expects all sendings to finish without errors'); }); }