Promise.mapSeries(reversedSeed, (seed) => callLater().then(() => seed.down(db.sequelize.getQueryInterface())))
/** * @description Execute an array of array of action. * @param {Object} self - Reference to the SceneManager. * @param {Object} actions - An array of array of actions from the db. * @param {Object} scope - The scope passed to all actions. * @returns {Promise} Resolve if the action was executed with success. * @example * executeActions(this, actions, {}); */ async function executeActions(self, actions, scope) { // first array level should be executed in serie await Promise.mapSeries(actions, async (parallelActions, columnIndex) => { // then, second level is executed in parallel await Promise.map(parallelActions, async (action, rowIndex) => { await executeAction(self, action, scope, columnIndex, rowIndex); }); }); return null; }
Promise.mapSeries(utils.normalizer(data), datum => { // Merge in default cli envars datum.opts.environment = utils.getCliEnvironment(datum.opts.environment); // Escape command if it is still a string if (_.isString(datum.cmd)) datum.cmd = utils.shellEscape(datum.cmd, true); return docker.isRunning(utils.getId(datum)).then(isRunning => { started = isRunning; if (!isRunning) { return exports.start(stripRun(datum), compose).then(() => { // if this is a prestart build step and its not the last one make sure we set started = true // this prevents us from having to stop and then restart the container during builds started = _.get(datum, 'opts.prestart', false) && !_.get(datum, 'opts.last', false); }); } }) // Why were we still using dockerode for this on non-win? .then(() => compose('run', _.merge({}, datum, {opts: {cmd: datum.cmd, id: datum.id}}))) // Stop if we have to .tap(() => { // If this is the last step of a build we need to make sure all the containers are stopped if (_.get(datum, 'opts.prestart', false) && _.get(datum, 'opts.last', false)) delete datum.opts.services; // Stop if we have to and remove build flags so lando doesn't get tripped up downstream if (!started || _.get(datum, 'opts.last', false)) return exports.stop(stripRun(datum), compose, docker); }) // Destroy if we have to .tap(() => { if (!started && _.get(datum, 'opts.autoRemove', false)) return exports.destroy(stripRun(datum), compose, docker); }); })
Promise.mapSeries(seeds, (seed) => callLater().then(() => seed.up(db.sequelize.getQueryInterface())))
Promise.mapSeries(_.keys(tests), (name) => { const testObj = tests[name] console.log('\n\n#----------------------------------------------')
return bluebird.mapSeries(
function main() { const runtimeArgs = minimist(process.argv.slice(2)); const { repeats } = runtimeArgs; Promise.resolve(runtimeArgs._) .mapSeries((testName, i, length) => { console.log(`[${ i + 1 }/${ length }] processing: ${path.basename(testName)}`); return measure(testName, { repeats }); }) .then(results => { console.log(`\nresults for ${repeats} executions\n`); prettyPrint(results, { repeats }); printPlatform(); }); }
function initData(n) { return Promise.resolve(getUrls(n)) .mapSeries(url => ({url: url, filters: ['save']})) .map(task => enqueueAsync(task), {concurrency: 2}) .reflect() }
Promise.mapSeries(inputFiles, function (file) { return new Promise(function (resolve, reject) { var reader = fs.createReadStream(file, { encoding: null }); reader.pipe( writer, { end: false }); reader.on('error', reject); reader.on('end', resolve); }); }).then(function() { writer.close(); return Promise.resolve(outputFile); })
Promise.mapSeries(documents, function(doc) { return doc.insert(_.clone(options)); })
/** * Validate all values in the iterable * @param {Iterable} value * @param {String} fieldName * @return {Promise<Iterable>} newValue */ validateEntries(value, fieldName) { const { valueType } = this; return Promise.mapSeries(value, function(val) { return valueType.validate(val, fieldName); }); }
function initData(n) { return Promise.resolve(getUrls(n)) .mapSeries(url => ({url: url, filters: ['save']})) .map(task => enqueueAsync(task), {concurrency: 2}) .reflect() }
function main() { const runtimeArgs = minimist(process.argv.slice(2)); const { repeats } = runtimeArgs; Promise.resolve(runtimeArgs._) .mapSeries((testName, i, length) => { console.log(`[${ i + 1 }/${ length }] processing: ${path.basename(testName)}`); return measure(testName, { repeats }); }) .then(results => { console.log(`\nresults for ${repeats} executions\n`); prettyPrint(results, { repeats }); printPlatform(); }); }