All Projects → feross → run-parallel-limit

feross / run-parallel-limit

Licence: MIT License
Run an array of functions in parallel, but limit the number of tasks executing at the same time

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to run-parallel-limit

laravel-parallel
Laravel parallel
Stars: ✭ 41 (-41.43%)
Mutual labels:  parallel
split-tests
Split test files in Jest and Cypress into parallel CI jobs
Stars: ✭ 22 (-68.57%)
Mutual labels:  parallel
piton
Run your Python algorithms in parallel and avoid the GIL
Stars: ✭ 40 (-42.86%)
Mutual labels:  parallel
VieCut
VieCut 1.00 - Shared-memory Minimum Cuts
Stars: ✭ 34 (-51.43%)
Mutual labels:  parallel
ezpq
an easy parallel queueing system
Stars: ✭ 42 (-40%)
Mutual labels:  parallel
pblat
parallelized blat with multi-threads support
Stars: ✭ 34 (-51.43%)
Mutual labels:  parallel
web-scraping-engine
A simple web scraping engine supporting concurrent and anonymous scraping
Stars: ✭ 27 (-61.43%)
Mutual labels:  parallel
RcppAlgos
Tool for Solving Problems in Combinatorics and Computational Mathematics
Stars: ✭ 31 (-55.71%)
Mutual labels:  parallel
tbslas
A parallel, fast solver for the scalar advection-diffusion and the incompressible Navier-Stokes equations based on semi-Lagrangian/Volume-Integral method.
Stars: ✭ 21 (-70%)
Mutual labels:  parallel
k-means
Code accompanying my blog post on k-means in Python, C++ and CUDA
Stars: ✭ 56 (-20%)
Mutual labels:  parallel
swarmci
Swarm CI - Docker Swarm-based CI system or enhancement to existing systems.
Stars: ✭ 48 (-31.43%)
Mutual labels:  parallel
jobflow
runs stuff in parallel (like GNU parallel, but much faster and memory-efficient)
Stars: ✭ 67 (-4.29%)
Mutual labels:  parallel
future.batchtools
🚀 R package future.batchtools: A Future API for Parallel and Distributed Processing using batchtools
Stars: ✭ 77 (+10%)
Mutual labels:  parallel
cruise
User space POSIX-like file system in main memory
Stars: ✭ 27 (-61.43%)
Mutual labels:  parallel
magi
📈 high level wrapper for parallel univariate time series forecasting 📉
Stars: ✭ 17 (-75.71%)
Mutual labels:  parallel
Parallel.GAMIT
Python wrapper to parallelize GAMIT executions
Stars: ✭ 22 (-68.57%)
Mutual labels:  parallel
multipart-download
Speed up download of a single file with multiple HTTP GET connections running in parallel
Stars: ✭ 29 (-58.57%)
Mutual labels:  parallel
Autonomx
Autonomx provides a complete testing platform for UI (Web, iOS, Android, Win) and API testing. It provides a feature rich and viable testing solution for end to end testing. It's designed to be fast, scalable, reliable and adaptable to any requirements for ever growing projects.
Stars: ✭ 14 (-80%)
Mutual labels:  parallel
Corium
Corium is a modern scripting language which combines simple, safe and efficient programming.
Stars: ✭ 18 (-74.29%)
Mutual labels:  parallel
asynckit
Minimal async jobs utility library, with streams support
Stars: ✭ 21 (-70%)
Mutual labels:  parallel

run-parallel-limit travis npm downloads javascript style guide

Run an array of functions in parallel, but limit the number of tasks executing at the same time

run-parallel-limit Sauce Test Status

install

npm install run-parallel-limit

usage

parallelLimit(tasks, limit, [callback])

Run the tasks array of functions in parallel, with a maximum of limit tasks executing at the same time. If any of the functions pass an error to its callback, the main callback is immediately called with the value of the error. Once the tasks have completed, the results are passed to the final callback as an array.

Note that the tasks are not executed in batches, so there is no guarantee that the first limit tasks will complete before any others are started.

It is also possible to use an object instead of an array. Each property will be run as a function and the results will be passed to the final callback as an object instead of an array. This can be a more readable way of handling the results.

arguments
  • tasks - An array or object containing functions to run. Each function is passed a callback(err, result) which it must call on completion with an error err (which can be null) and an optional result value.
  • limit - The maximum number of tasks to run at any time.
  • callback(err, results) - An optional callback to run once all the functions have completed. This function gets a results array (or object) containing all the result arguments passed to the task callbacks.
example
var parallelLimit = require('run-parallel-limit')

var tasks = [
  function (callback) {
    setTimeout(function () {
      callback(null, 'one')
    }, 200)
  },
  function (callback) {
    setTimeout(function () {
      callback(null, 'two')
    }, 100)
  },
  ... hundreds more tasks ...
]

parallelLimit(tasks, 5, function (err, results) {
  // optional callback
  // the results array will equal ['one', 'two', ...] even though
  // the second function had a shorter timeout.
})

The above code runs with a concurrency limit of 5, so at most 5 tasks will be running at any given time.

This module is basically equavalent to async.parallelLimit, but it's handy to just have the one function you need instead of the kitchen sink. Modularity! Especially handy if you're serving to the browser and need to reduce your javascript bundle size.

Works great in the browser with browserify!

see also

license

MIT. Copyright (c) Feross Aboukhadijeh.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].