node-runnablepool
A runnable (spawn) pool lib. An easy way to use multi proc with node.
https://npmjs.org/package/runnablepool
Installing runnablepool
[sudo] npm install [-g] runnablepool
Usage
Lib: inherits from Runnable class.
Create a dedicated file to run the Runnable instance. See examples/basic_runnable.js
varutil = rp = BasicRunnable = { { thisverbose = false; rpRunnable; } util; BasicRunnableprototype{ // Do you stuff here. // Once you done, just call callback function with results as params ; }; return BasicRunnable;}run = ; // class must be instanciated: it's got interfaces to be managed by the pooler.
Lib: instanciate a RunnablePool with BasicRunnable script
varutil = i = 0rp = pool = modulePath: __dirname + '/basic_runnable.js' // Here is our Runnable script;pool; pool; pool; fori = 0; i < 1000; i++ pool;
Examples
- pooler: examples/basic.js
- runnable: examples/basic_runnable.js
Debug
Just call run.run()
varutil = rp = BasicRunnable = { ...}run = ;run; // do forget to remove it once you are done !
Run it as usual
node basic_runnable.js
Classes
RunnablePool
/*** @constructor* @param * @param * @param * @param * @param * @param * Emit 'result' function(* Emit 'end' function({Array of {* Emit 'error' function(*/ /*** @public* @param* This method fill the pooler*/Runnable.prototype.run = function(config)
License
node-runnablepool is licensed under the MIT license.