@stdlib/utils-parallel 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +1 -1
- package/README.md +32 -35
- package/dist/index.js +15 -15
- package/dist/index.js.map +3 -3
- package/docs/types/index.d.ts +2 -2
- package/lib/defaults.js +8 -2
- package/lib/index.js +2 -1
- package/lib/main.js +6 -6
- package/lib/node/exec.js +31 -20
- package/lib/node/worker/spawn.js +3 -2
- package/package.json +17 -16
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2026 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -245,11 +245,6 @@ var writeFileSync = require( '@stdlib/fs-write-file' ).sync;
|
|
|
245
245
|
var unlinkSync = require( '@stdlib/fs-unlink' ).sync;
|
|
246
246
|
var parallel = require( '@stdlib/utils-parallel' );
|
|
247
247
|
|
|
248
|
-
var nFiles = 100;
|
|
249
|
-
var files;
|
|
250
|
-
var opts;
|
|
251
|
-
var dir;
|
|
252
|
-
|
|
253
248
|
function template( id ) {
|
|
254
249
|
var file = '';
|
|
255
250
|
|
|
@@ -282,45 +277,28 @@ function createScripts( dir, nFiles ) {
|
|
|
282
277
|
var files;
|
|
283
278
|
var i;
|
|
284
279
|
|
|
285
|
-
files =
|
|
280
|
+
files = [];
|
|
286
281
|
for ( i = 0; i < nFiles; i++ ) {
|
|
287
282
|
content = template( i.toString() );
|
|
288
283
|
fpath = path.join( dir, i+'.js' );
|
|
289
284
|
writeFileSync( fpath, content, {
|
|
290
285
|
'encoding': 'utf8'
|
|
291
286
|
});
|
|
292
|
-
files
|
|
287
|
+
files.push( fpath );
|
|
293
288
|
}
|
|
294
289
|
return files;
|
|
295
290
|
}
|
|
296
291
|
|
|
297
|
-
|
|
298
|
-
var i;
|
|
299
|
-
|
|
300
|
-
// Delete the temporary files...
|
|
301
|
-
for ( i = 0; i < files.length; i++ ) {
|
|
302
|
-
unlinkSync( files[ i ] );
|
|
303
|
-
}
|
|
304
|
-
// Remove temporary directory:
|
|
305
|
-
fs.rmdirSync( dir );
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
function done( error ) {
|
|
309
|
-
if ( error ) {
|
|
310
|
-
throw error;
|
|
311
|
-
}
|
|
312
|
-
cleanup();
|
|
313
|
-
console.log( 'Done!' );
|
|
314
|
-
}
|
|
292
|
+
var nFiles = 10;
|
|
315
293
|
|
|
316
|
-
// Make a temporary directory to store files
|
|
317
|
-
dir = createDir();
|
|
294
|
+
// Make a temporary directory to store files:
|
|
295
|
+
var dir = createDir();
|
|
318
296
|
|
|
319
|
-
// Create temporary files
|
|
320
|
-
files = createScripts( dir, nFiles );
|
|
297
|
+
// Create temporary files:
|
|
298
|
+
var files = createScripts( dir, nFiles );
|
|
321
299
|
|
|
322
300
|
// Set the runner options:
|
|
323
|
-
opts = {
|
|
301
|
+
var opts = {
|
|
324
302
|
'concurrency': 3,
|
|
325
303
|
'workers': 3,
|
|
326
304
|
'ordered': false
|
|
@@ -328,6 +306,25 @@ opts = {
|
|
|
328
306
|
|
|
329
307
|
// Run all temporary scripts:
|
|
330
308
|
parallel( files, opts, done );
|
|
309
|
+
|
|
310
|
+
function done( error ) {
|
|
311
|
+
if ( error ) {
|
|
312
|
+
console.log( error.message );
|
|
313
|
+
}
|
|
314
|
+
cleanup();
|
|
315
|
+
console.log( 'Done!' );
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
function cleanup() {
|
|
319
|
+
var i;
|
|
320
|
+
|
|
321
|
+
// Delete the temporary files...
|
|
322
|
+
for ( i = 0; i < files.length; i++ ) {
|
|
323
|
+
unlinkSync( files[ i ] );
|
|
324
|
+
}
|
|
325
|
+
// Remove temporary directory:
|
|
326
|
+
fs.rmdirSync( dir );
|
|
327
|
+
}
|
|
331
328
|
```
|
|
332
329
|
|
|
333
330
|
</section>
|
|
@@ -375,7 +372,7 @@ See [LICENSE][stdlib-license].
|
|
|
375
372
|
|
|
376
373
|
## Copyright
|
|
377
374
|
|
|
378
|
-
Copyright © 2016-
|
|
375
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
379
376
|
|
|
380
377
|
</section>
|
|
381
378
|
|
|
@@ -390,8 +387,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
390
387
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/utils-parallel.svg
|
|
391
388
|
[npm-url]: https://npmjs.org/package/@stdlib/utils-parallel
|
|
392
389
|
|
|
393
|
-
[test-image]: https://github.com/stdlib-js/utils-parallel/actions/workflows/test.yml/badge.svg?branch=v0.3.
|
|
394
|
-
[test-url]: https://github.com/stdlib-js/utils-parallel/actions/workflows/test.yml?query=branch:v0.3.
|
|
390
|
+
[test-image]: https://github.com/stdlib-js/utils-parallel/actions/workflows/test.yml/badge.svg?branch=v0.3.3
|
|
391
|
+
[test-url]: https://github.com/stdlib-js/utils-parallel/actions/workflows/test.yml?query=branch:v0.3.3
|
|
395
392
|
|
|
396
393
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/utils-parallel/main.svg
|
|
397
394
|
[coverage-url]: https://codecov.io/github/stdlib-js/utils-parallel?branch=main
|
|
@@ -403,8 +400,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
403
400
|
|
|
404
401
|
-->
|
|
405
402
|
|
|
406
|
-
[chat-image]: https://img.shields.io/
|
|
407
|
-
[chat-url]: https://
|
|
403
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
404
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
408
405
|
|
|
409
406
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
410
407
|
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";var p=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var B=p(function(
|
|
2
|
-
var
|
|
3
|
-
});var K=p(function(
|
|
4
|
-
var
|
|
5
|
-
});var W=p(function(
|
|
6
|
-
var tr=require('@stdlib/utils-keys/dist'),P=require('@stdlib/process-env/dist');function
|
|
7
|
-
});var
|
|
8
|
-
var
|
|
9
|
-
});var A=p(function(
|
|
10
|
-
var
|
|
11
|
-
});var
|
|
12
|
-
var
|
|
13
|
-
});var
|
|
14
|
-
var
|
|
15
|
-
});var
|
|
1
|
+
"use strict";var p=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var B=p(function(Br,T){
|
|
2
|
+
var Z=require('@stdlib/os-num-cpus/dist'),$=require('@stdlib/math-base-special-fast-max/dist');function rr(){var e;return e=$(1,Z-1),{workers:e,concurrency:e,cmd:"node",ordered:!1,uid:null,gid:null,encoding:"buffer",maxBuffer:200*1024*1024}}T.exports=rr
|
|
3
|
+
});var K=p(function(_r,I){
|
|
4
|
+
var er=require('@stdlib/assert-is-plain-object/dist'),w=require('@stdlib/assert-has-own-property/dist'),_=require('@stdlib/assert-is-positive-integer/dist').isPrimitive,O=require('@stdlib/assert-is-nonnegative-integer/dist').isPrimitive,ir=require('@stdlib/assert-is-boolean/dist').isPrimitive,nr=require('@stdlib/assert-is-string/dist').isPrimitive,v=require('@stdlib/error-tools-fmtprodmsg/dist');function ur(e,r){return er(r)?w(r,"concurrency")&&(e.concurrency=r.concurrency,!_(e.concurrency))?new TypeError(v('1WZ3P',"concurrency",e.concurrency)):w(r,"workers")&&(e.workers=r.workers,!_(e.workers))?new TypeError(v('1WZ3P',"workers",e.workers)):w(r,"cmd")&&(e.cmd=r.cmd,!nr(e.cmd))?new TypeError(v('1WZ2W',"cmd",e.cmd)):w(r,"ordered")&&(e.ordered=r.ordered,!ir(e.ordered))?new TypeError(v('1WZ2o',"ordered",e.ordered)):w(r,"uid")&&(e.uid=r.uid,!O(e.uid))?new TypeError(v('1WZ2t',"uid",e.uid)):w(r,"gid")&&(e.gid=r.gid,!O(e.gid))?new TypeError(v('1WZ2t',"gid",e.gid)):w(r,"maxBuffer")&&(e.maxBuffer=r.maxBuffer,!O(e.maxBuffer))?new TypeError(v('1WZ2t',"maxBuffer",e.maxBuffer)):null:new TypeError(v('1WZ2V',r));}I.exports=ur
|
|
5
|
+
});var W=p(function(Ir,D){
|
|
6
|
+
var tr=require('@stdlib/utils-keys/dist'),P=require('@stdlib/process-env/dist');function ar(){var e,r,d,o;for(e=tr(P),d={},o=0;o<e.length;o++)r=e[o],d[r]=P[r];return d}function dr(e){var r=ar();return r.WORKER_CMD=e.cmd,r.WORKER_ENCODING=e.encoding,r.WORKER_MAX_BUFFER=e.maxBuffer,e.ordered&&(r.WORKER_ORDERED="1"),e.uid&&(r.WORKER_UID=e.uid),e.gid&&(r.WORKER_GID=e.gid),r}D.exports=dr
|
|
7
|
+
});var N=p(function(Kr,F){
|
|
8
|
+
var or=require('@stdlib/process-cwd/dist'),sr=W();function cr(e){var r={cwd:or(),env:sr(e),stdio:"inherit"};return e.uid&&(r.uid=e.uid),e.gid&&(r.gid=e.gid),r}F.exports=cr
|
|
9
|
+
});var A=p(function(Pr,S){
|
|
10
|
+
var fr=require("child_process").fork,vr=require("path"),lr=require("debug"),k=require('@stdlib/utils-keys/dist'),j=require('@stdlib/error-tools-fmtprodmsg/dist'),gr=N(),t=lr("parallel:exec"),mr=vr.resolve(__dirname,"./worker/index.js");function pr(e){return r;function r(){t("Child process disconnected. pid: %d.",e.pid)}}function wr(e,r,d){var o,s,l,f,x,a,y,b,g,h,q,m;for(q=!1,t("Options: %s.",JSON.stringify(r)),o=0,t("Creating %d workers...",r.workers),s={},x=[],f=gr(r),m=0;m<r.workers;m++)t("Creating child process..."),a=fr(mr,x,f),a.on("error",Q(a)),a.on("close",J(a)),a.on("exit",z(a)),a.on("disconnect",pr(a)),a.on("message",H(a)),t("Child process created. pid: %d.",a.pid),s[a.pid]=a;for(y=k(s),t("%d workers created.",y.length),t("Running %d scripts concurrently...",r.concurrency),l={},g=-1,m=0;m<r.concurrency;m++)b=y[m%y.length],C(s[b]);function C(n){var u;if(g+=1,g>=e.length){if(u=k(l).length,u>0){t("%d scripts are pending.",u);return}return t("All scripts have finished."),E()}t("Instructing child process to run script: %s. pid: %d.",e[g],n.pid),n.send(e[g]),l[e[g]]=!0,t("%d of %d scripts have been processed.",g,e.length)}function H(n){return u;function u(i){t("Child process message: %s. pid: %d.",i,n.pid),delete l[i],C(n)}}function J(n){return u;function u(i,c){t("Child process closed. Code: %d. Signal: %s. pid: %d.",i,c,n.pid),R(i,c),X()}}function X(){o+=1,t("%d of %d child processes have closed.",o,r.workers),o===r.workers&&Y()}function z(n){return u;function u(i,c){t("Child process exited. Code: %d. Signal: %s. pid: %d.",i,c,n.pid),R(i,c)}}function E(n){var u,i,c;if(!q)for(q=!0,n&&!h&&(h=n),t("Instructing child processes to close..."),u=k(s),c=0;c<u.length;c++)i=u[c],t("Instructing child process (pid: %d) to close...",i),s[i].send("close")}function Q(n){return u;function u(i){t("Child process error: %s. pid: %d.",i.message,n.pid),E(i)}}function R(n,u){var i;if(!h&&(n!==null&&n!==0?i=new Error(j('1WZBi',n)):u!==null&&(i=new Error(j('1WZBj',u))),i))return i.code=n,i.signal=u,E(i)}function Y(){if(h)return d(h);d()}}S.exports=wr
|
|
11
|
+
});var G=p(function(Dr,V){
|
|
12
|
+
var hr=A();V.exports=hr
|
|
13
|
+
});var L=p(function(Wr,U){
|
|
14
|
+
var xr=require("path").resolve,yr=require('@stdlib/assert-is-string-array/dist').primitives,qr=require('@stdlib/assert-is-function/dist'),M=require('@stdlib/error-tools-fmtprodmsg/dist'),Er=require('@stdlib/process-cwd/dist'),Or=B(),kr=K(),br=G();function Cr(){var e,r,d,o,s,l,f;if(r=arguments[0],!yr(r))throw new TypeError(M('1WZ3s',r));if(r=r.slice(),d=Or(),arguments.length>2){if(e=arguments[1],o=arguments[2],s=kr(d,e),s)throw s}else o=arguments[1];if(!qr(o))throw new TypeError(M('1WZ2b',o));for(d.concurrency>r.length&&(d.concurrency=r.length||1),d.workers>d.concurrency&&(d.workers=d.concurrency),l=Er(),f=0;f<r.length;f++)r[f]=xr(l,r[f]);br(r,d,x);function x(a){if(a)return o(a);o()}}U.exports=Cr
|
|
15
|
+
});var Rr=L();module.exports=Rr;
|
|
16
16
|
/** @license Apache-2.0 */
|
|
17
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../lib/defaults.js", "../lib/validate.js", "../lib/node/env.js", "../lib/node/options.js", "../lib/node/exec.js", "../lib/node/index.js", "../lib/main.js", "../lib/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar numCPUs = require( '@stdlib/os-num-cpus' );\n\n\n// MAIN //\n\n/**\n* Returns default options.\n*\n* @private\n* @returns {Object} default options\n*\n* @example\n* var o = defaults();\n* // returns {...}\n*/\nfunction defaults() {\n\treturn {\n\t\t// Number of workers:\n\t\t'workers': numCPUs - 1,\n\n\t\t// Number of scripts to execute concurrently:\n\t\t'concurrency': numCPUs - 1,\n\n\t\t// Executable file/command:\n\t\t'cmd': 'node',\n\n\t\t// Boolean indicating whether script output can be interleaved or must be ordered:\n\t\t'ordered': false,\n\n\t\t// Process user identity:\n\t\t'uid': null,\n\n\t\t// Process group identity:\n\t\t'gid': null,\n\n\t\t// `stdio` encoding:\n\t\t'encoding': 'buffer',\n\n\t\t// Max child process `stdio` buffer size:\n\t\t'maxBuffer': 200 * 1024 * 1024 // bytes\n\t};\n}\n\n\n// EXPORTS //\n\nmodule.exports = defaults;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isObject = require( '@stdlib/assert-is-plain-object' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isPositiveInteger = require( '@stdlib/assert-is-positive-integer' ).isPrimitive;\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - options to validate\n* @param {string} [options.cmd] - executable file/command\n* @param {PositiveInteger} [options.concurrency] - number of scripts to execute concurrently\n* @param {PositiveInteger} [options.workers] - number of workers\n* @param {boolean} [options.ordered] - boolean indicating whether to preserve the order of script output\n* @param {NonNegativeInteger} [options.uid] - process user identity\n* @param {NonNegativeInteger} [options.gid] - process group identity\n* @param {NonNegativeInteger} [options.maxBuffer] - max child process `stdio` buffer size\n* @returns {(Error|null)} error or null\n*\n* @example\n* var opts = {};\n* var options = {\n* 'concurrency': 4,\n* 'workers': 2\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tif ( hasOwnProp( options, 'concurrency' ) ) {\n\t\topts.concurrency = options.concurrency;\n\t\tif ( !isPositiveInteger( opts.concurrency ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'concurrency', opts.concurrency ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'workers' ) ) {\n\t\topts.workers = options.workers;\n\t\tif ( !isPositiveInteger( opts.workers ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'workers', opts.workers ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'cmd' ) ) {\n\t\topts.cmd = options.cmd;\n\t\tif ( !isString( opts.cmd ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'cmd', opts.cmd ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'ordered' ) ) {\n\t\topts.ordered = options.ordered;\n\t\tif ( !isBoolean( opts.ordered ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'ordered', opts.ordered ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'uid' ) ) {\n\t\topts.uid = options.uid;\n\t\tif ( !isNonNegativeInteger( opts.uid ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`.', 'uid', opts.uid ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'gid' ) ) {\n\t\topts.gid = options.gid;\n\t\tif ( !isNonNegativeInteger( opts.gid ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`.', 'gid', opts.gid ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'maxBuffer' ) ) {\n\t\topts.maxBuffer = options.maxBuffer;\n\t\tif ( !isNonNegativeInteger( opts.maxBuffer ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`.', 'maxBuffer', opts.maxBuffer ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = validate;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar objectKeys = require( '@stdlib/utils-keys' );\nvar ENV = require( '@stdlib/process-env' );\n\n\n// FUNCTIONS //\n\n/**\n* Copies `process.env`.\n*\n* ## Notes\n*\n* - This implementation accommodates `process.env` on older Node.js versions (<=v0.10.x), where `process.env` was object-like, but would show unexpected behavior when attempting to get own property descriptors.\n*\n* @private\n* @returns {Object} copy of `process.env`\n*/\nfunction copy() {\n\tvar keys;\n\tvar env;\n\tvar out;\n\tvar i;\n\n\tkeys = objectKeys( ENV );\n\tout = {};\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\tenv = keys[ i ];\n\t\tout[ env ] = ENV[ env ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Returns worker environment variables.\n*\n* @private\n* @param {Options} opts - options\n* @param {string} opts.cmd - executable file/command\n* @param {boolean} opts.ordered - boolean indicating whether to preserve order of script output\n* @param {(NonNegativeInteger|null)} opts.uid - process user identity\n* @param {(NonNegativeInteger|null)} opts.gid - process group identity\n* @param {string} opts.encoding - `stdio` encoding\n* @param {NonNegativeInteger} opts.maxBuffer - max child process `stdio` buffer size\n* @returns {Object} environment variables\n*/\nfunction env( opts ) {\n\tvar out = copy();\n\n\tout.WORKER_CMD = opts.cmd;\n\tout.WORKER_ENCODING = opts.encoding;\n\tout.WORKER_MAX_BUFFER = opts.maxBuffer;\n\n\tif ( opts.ordered ) {\n\t\tout.WORKER_ORDERED = '1';\n\t}\n\tif ( opts.uid ) {\n\t\tout.WORKER_UID = opts.uid;\n\t}\n\tif ( opts.gid ) {\n\t\tout.WORKER_GID = opts.gid;\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = env;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar cwd = require( '@stdlib/process-cwd' );\nvar env = require( './env.js' );\n\n\n// MAIN //\n\n/**\n* Returns child process options.\n*\n* @private\n* @param {Options} options - worker options\n* @param {(NonNegativeInteger|null)} [options.uid] - process user identity\n* @param {(NonNegativeInteger|null)} [options.gid] - process group identity\n* @returns {Object} child process options\n*/\nfunction getOpts( options ) {\n\tvar opts = {\n\t\t'cwd': cwd(),\n\t\t'env': env( options ),\n\t\t'stdio': 'inherit' // Use stdio of parent process\n\t};\n\tif ( options.uid ) {\n\t\topts.uid = options.uid;\n\t}\n\tif ( options.gid ) {\n\t\topts.gid = options.gid;\n\t}\n\treturn opts;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOpts;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fork = require( 'child_process' ).fork;\nvar path = require( 'path' );\nvar logger = require( 'debug' );\nvar objectKeys = require( '@stdlib/utils-keys' );\nvar format = require( '@stdlib/string-format' );\nvar getOpts = require( './options.js' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'parallel:exec' );\nvar WORKER_FILEPATH = path.resolve( __dirname, './worker/index.js' );\n\n\n// MAIN //\n\n/**\n* Executes scripts in parallel.\n*\n* @private\n* @param {StringArray} files - script absolute file paths\n* @param {Options} opts - options\n* @param {PositiveInteger} opts.concurrency - number of scripts to execute concurrently\n* @param {PositiveInteger} opts.workers - number of workers\n* @param {string} opts.cmd - executable file/command\n* @param {boolean} opts.ordered - boolean indicating whether to preserve order of script output\n* @param {(NonNegativeInteger|null)} opts.uid - process user identity\n* @param {(NonNegativeInteger|null)} opts.gid - process group identity\n* @param {string} opts.encoding - `stdio` encoding\n* @param {NonNegativeInteger} opts.maxBuffer - max child process `stdio` buffer size\n* @param {Callback} clbk - callback to invoke after executing all scripts\n*/\nfunction exec( files, opts, clbk ) {\n\tvar numClosed;\n\tvar workers;\n\tvar pending;\n\tvar fopts;\n\tvar args;\n\tvar proc;\n\tvar pids;\n\tvar pid;\n\tvar idx;\n\tvar err;\n\tvar i;\n\n\tdebug( 'Options: %s.', JSON.stringify( opts ) );\n\tnumClosed = 0;\n\n\tdebug( 'Creating %d workers...', opts.workers );\n\tworkers = {};\n\targs = [];\n\tfopts = getOpts( opts );\n\tfor ( i = 0; i < opts.workers; i++ ) {\n\t\tdebug( 'Creating child process...' );\n\t\tproc = fork( WORKER_FILEPATH, args, fopts );\n\n\t\tproc.on( 'error', onError( proc ) );\n\t\tproc.on( 'close', onClose( proc ) );\n\t\tproc.on( 'exit', onExit( proc ) );\n\t\tproc.on( 'disconnect', onDisconnect( proc ) );\n\t\tproc.on( 'message', onMessage( proc ) );\n\n\t\tdebug( 'Child process created. pid: %d.', proc.pid );\n\t\tworkers[ proc.pid ] = proc;\n\t}\n\tpids = objectKeys( workers );\n\tdebug( '%d workers created.', pids.length );\n\n\tdebug( 'Running %d scripts concurrently...', opts.concurrency );\n\tpending = {};\n\tidx = -1;\n\tfor ( i = 0; i < opts.concurrency; i++ ) {\n\t\tpid = pids[ i%pids.length ];\n\t\tnext( workers[ pid ] ); // eslint-disable-line node/callback-return\n\t}\n\n\t/**\n\t* Instructs a child process to run the next script.\n\t*\n\t* @private\n\t* @param {Object} child - child process\n\t* @returns {void}\n\t*/\n\tfunction next( child ) {\n\t\tvar numPending;\n\t\tidx += 1;\n\t\tif ( idx >= files.length ) {\n\t\t\tnumPending = objectKeys( pending ).length;\n\t\t\tif ( numPending > 0 ) {\n\t\t\t\tdebug( '%d scripts are pending.', numPending );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdebug( 'All scripts have finished.' );\n\t\t\treturn close();\n\t\t}\n\t\tdebug( 'Instructing child process to run script: %s. pid: %d.', files[ idx ], child.pid );\n\t\tchild.send( files[ idx ] );\n\t\tpending[ files[ idx ] ] = true;\n\n\t\tdebug( '%d of %d scripts have been processed.', idx, files.length );\n\t}\n\n\t/**\n\t* Returns a callback to be invoked upon receiving a message from a child process.\n\t*\n\t* @private\n\t* @param {Object} child - child process\n\t* @returns {Callback} callback\n\t*/\n\tfunction onMessage( child ) {\n\t\treturn listener;\n\n\t\t/**\n\t\t* Callback invoked upon receiving a message from a child process.\n\t\t*\n\t\t* @private\n\t\t* @param {string} filepath - script filepath\n\t\t*/\n\t\tfunction listener( filepath ) {\n\t\t\tdebug( 'Child process message: %s. pid: %d.', filepath, child.pid );\n\n\t\t\t// Remove the script from the listing of pending scripts:\n\t\t\tdelete pending[ filepath ];\n\n\t\t\t// Indicate that the child process is ready for its next task:\n\t\t\tnext( child );\n\t\t}\n\t}\n\n\t/**\n\t* Returns a callback to be invoked upon child process close.\n\t*\n\t* @private\n\t* @param {Object} child - child process\n\t* @returns {Callback} callback\n\t*/\n\tfunction onClose( child ) {\n\t\treturn listener;\n\n\t\t/**\n\t\t* Callback invoked upon child process close.\n\t\t*\n\t\t* @private\n\t\t* @param {(number|null)} code - exit code\n\t\t* @param {(string|null)} signal - termination signal\n\t\t*/\n\t\tfunction listener( code, signal ) {\n\t\t\tdebug( 'Child process closed. Code: %d. Signal: %s. pid: %d.', code, signal, child.pid );\n\t\t\tprocessExit( code, signal );\n\t\t\tchildClosed();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked if a child closes.\n\t*\n\t* @private\n\t*/\n\tfunction childClosed() {\n\t\tnumClosed += 1;\n\t\tdebug( '%d of %d child processes have closed.', numClosed, opts.workers );\n\t\tif ( numClosed === opts.workers ) {\n\t\t\tdone(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Returns a callback to be invoked upon child process exit.\n\t*\n\t* @private\n\t* @param {Object} child - child process\n\t* @returns {Callback} callback\n\t*/\n\tfunction onExit( child ) {\n\t\treturn listener;\n\n\t\t/**\n\t\t* Callback invoked upon child process exit.\n\t\t*\n\t\t* @private\n\t\t* @param {(number|null)} code - exit code\n\t\t* @param {(string|null)} signal - termination signal\n\t\t*/\n\t\tfunction listener( code, signal ) {\n\t\t\tdebug( 'Child process exited. Code: %d. Signal: %s. pid: %d.', code, signal, child.pid );\n\t\t\tprocessExit( code, signal );\n\t\t}\n\t}\n\n\t/**\n\t* Closes all workers.\n\t*\n\t* @private\n\t* @param {Error} [error] - error object\n\t*/\n\tfunction close( error ) {\n\t\tvar pids;\n\t\tvar pid;\n\t\tvar i;\n\t\tif ( error && !err ) {\n\t\t\terr = error;\n\t\t}\n\t\tdebug( 'Instructing child processes to close...' );\n\t\tpids = objectKeys( workers );\n\t\tfor ( i = 0; i < pids.length; i++ ) {\n\t\t\tpid = pids[ i ];\n\t\t\tdebug( 'Instructing child process (pid: %d) to close...', pid );\n\t\t\tworkers[ pid ].send( 'close' );\n\t\t}\n\t}\n\n\t/**\n\t* Returns a callback to be invoked upon child process disconnect.\n\t*\n\t* @private\n\t* @param {Object} child - child process\n\t* @returns {Callback} callback\n\t*/\n\tfunction onDisconnect( child ) {\n\t\treturn listener;\n\n\t\t/**\n\t\t* Callback invoked upon child process disconnect.\n\t\t*\n\t\t* @private\n\t\t*/\n\t\tfunction listener() {\n\t\t\tdebug( 'Child process disconnected. pid: %d.', child.pid );\n\t\t}\n\t}\n\n\t/**\n\t* Returns a callback to be invoked upon encountering a child process error.\n\t*\n\t* @private\n\t* @param {Object} child - child process\n\t* @returns {Callback} callback\n\t*/\n\tfunction onError( child ) {\n\t\treturn listener;\n\n\t\t/**\n\t\t* Callback invoked upon a child process error.\n\t\t*\n\t\t* @private\n\t\t* @param {Error} error - error object\n\t\t*/\n\t\tfunction listener( error ) {\n\t\t\tdebug( 'Child process error: %s. pid: %d.', error.message, child.pid );\n\t\t\tclose( error );\n\t\t}\n\t}\n\n\t/**\n\t* Processes process exit values. If provided a non-zero exit code or termination signal, instructs the process to close.\n\t*\n\t* @private\n\t* @param {(number|null)} code - exit code\n\t* @param {(string|null)} signal - termination signal\n\t* @returns {void}\n\t*/\n\tfunction processExit( code, signal ) {\n\t\tvar error;\n\t\tif ( err ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( code !== null && code !== 0 ) {\n\t\t\terror = new Error( format( 'unexpected error. Child process failed with exit code: `%u`.', code ) );\n\t\t} else if ( signal !== null ) {\n\t\t\terror = new Error( format( 'unexpected error. Child process failed due to termination signal: `%s`.', signal ) );\n\t\t}\n\t\tif ( error ) {\n\t\t\terror.code = code;\n\t\t\terror.signal = signal;\n\t\t\treturn close( error );\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once all tasks are finished.\n\t*\n\t* @private\n\t* @returns {void}\n\t*/\n\tfunction done() {\n\t\tif ( err ) {\n\t\t\treturn clbk( err );\n\t\t}\n\t\tclbk();\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = exec;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar exec = require( './exec.js' );\n\n\n// EXPORTS //\n\nmodule.exports = exec;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar path = require( 'path' );\nvar isStringArray = require( '@stdlib/assert-is-string-array' ).primitives;\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar format = require( '@stdlib/string-format' );\nvar cwd = require( '@stdlib/process-cwd' );\nvar defaults = require( './defaults.js' );\nvar validate = require( './validate.js' );\nvar exec = require( './node' );\n\n\n// MAIN //\n\n/**\n* Executes scripts in parallel.\n*\n* @param {StringArray} files - script file paths\n* @param {Options} [options] - function options\n* @param {string} [options.cmd='node'] - executable file/command\n* @param {PositiveInteger} [options.concurrency] - number of scripts to execute concurrently\n* @param {PositiveInteger} [options.workers] - number of workers\n* @param {boolean} [options.ordered=false] - boolean indicating whether to preserve the order of script output\n* @param {NonNegativeInteger} [options.uid] - process user identity\n* @param {NonNegativeInteger} [options.gid] - process group identity\n* @param {NonNegativeInteger} [options.maxBuffer=200*1024*1024] - max child process `stdio` buffer size\n* @param {Callback} clbk - callback to invoke after executing all scripts\n* @throws {TypeError} first argument must be an array of strings\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} callback argument must be a function\n*\n* @example\n* var files = [ './a.js', './b.js ' ];\n*\n* var opts = {\n* 'workers': 3,\n* 'concurrency': 3\n* };\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* }\n*\n* parallel( files, opts, done );\n*/\nfunction parallel() {\n\tvar options;\n\tvar files;\n\tvar opts;\n\tvar clbk;\n\tvar err;\n\tvar dir;\n\tvar i;\n\n\tfiles = arguments[ 0 ];\n\tif ( !isStringArray( files ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array of strings. Value: `%s`.', files ) );\n\t}\n\tfiles = files.slice();\n\topts = defaults();\n\tif ( arguments.length > 2 ) {\n\t\toptions = arguments[ 1 ];\n\t\tclbk = arguments[ 2 ];\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t} else {\n\t\tclbk = arguments[ 1 ];\n\t}\n\tif ( !isFunction( clbk ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) );\n\t}\n\t// Prevent the number of concurrent scripts exceeding the number of actual scripts to run.\n\tif ( opts.concurrency > files.length ) {\n\t\topts.concurrency = files.length;\n\t}\n\t// Prevent the number of workers exceeding the number of concurrent scripts (excess capacity), as some workers would never be allocated scripts to run and always be idle.\n\tif ( opts.workers > opts.concurrency ) {\n\t\topts.workers = opts.concurrency;\n\t}\n\t// Resolve any relative paths to absolute paths...\n\tdir = cwd();\n\tfor ( i = 0; i < files.length; i++ ) {\n\t\tfiles[ i ] = path.resolve( dir, files[ i ] );\n\t}\n\texec( files, opts, done );\n\n\t/**\n\t* Callback invoked after executing all scripts.\n\t*\n\t* @private\n\t* @param {Error} error - error object\n\t* @returns {void}\n\t*/\n\tfunction done( error ) {\n\t\tif ( error ) {\n\t\t\treturn clbk( error );\n\t\t}\n\t\tclbk();\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = parallel;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Execute scripts in parallel.\n*\n* @module @stdlib/utils-parallel\n*\n* @example\n* var parallel = require( '@stdlib/utils-parallel' );\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* }\n* var files = [ './a.js', './b.js' ];\n* parallel( files, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
|
|
5
|
-
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cAsBA,IAAIC,EAAU,QAAS,qBAAsB,
|
|
6
|
-
"names": ["require_defaults", "__commonJSMin", "exports", "module", "numCPUs", "defaults", "require_validate", "__commonJSMin", "exports", "module", "isObject", "hasOwnProp", "isPositiveInteger", "isNonNegativeInteger", "isBoolean", "isString", "format", "validate", "opts", "options", "require_env", "__commonJSMin", "exports", "module", "objectKeys", "ENV", "copy", "keys", "env", "out", "i", "opts", "require_options", "__commonJSMin", "exports", "module", "cwd", "env", "getOpts", "options", "opts", "require_exec", "__commonJSMin", "exports", "module", "fork", "path", "logger", "objectKeys", "format", "getOpts", "debug", "WORKER_FILEPATH", "exec", "files", "opts", "clbk", "numClosed", "workers", "pending", "fopts", "args", "proc", "pids", "pid", "idx", "err", "i", "onError", "onClose", "onExit", "
|
|
4
|
+
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar numCPUs = require( '@stdlib/os-num-cpus' );\nvar max = require( '@stdlib/math-base-special-fast-max' );\n\n\n// MAIN //\n\n/**\n* Returns default options.\n*\n* @private\n* @returns {Object} default options\n*\n* @example\n* var o = defaults();\n* // returns {...}\n*/\nfunction defaults() {\n\tvar n;\n\n\t// Accommodate single-core systems by ensuring at least 1 worker and 1 concurrent script:\n\tn = max( 1, numCPUs - 1 );\n\n\treturn {\n\t\t// Number of workers:\n\t\t'workers': n,\n\n\t\t// Number of scripts to execute concurrently:\n\t\t'concurrency': n,\n\n\t\t// Executable file/command:\n\t\t'cmd': 'node',\n\n\t\t// Boolean indicating whether script output can be interleaved or must be ordered:\n\t\t'ordered': false,\n\n\t\t// Process user identity:\n\t\t'uid': null,\n\n\t\t// Process group identity:\n\t\t'gid': null,\n\n\t\t// `stdio` encoding:\n\t\t'encoding': 'buffer',\n\n\t\t// Max child process `stdio` buffer size:\n\t\t'maxBuffer': 200 * 1024 * 1024 // bytes\n\t};\n}\n\n\n// EXPORTS //\n\nmodule.exports = defaults;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isObject = require( '@stdlib/assert-is-plain-object' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isPositiveInteger = require( '@stdlib/assert-is-positive-integer' ).isPrimitive;\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - options to validate\n* @param {string} [options.cmd] - executable file/command\n* @param {PositiveInteger} [options.concurrency] - number of scripts to execute concurrently\n* @param {PositiveInteger} [options.workers] - number of workers\n* @param {boolean} [options.ordered] - boolean indicating whether to preserve the order of script output\n* @param {NonNegativeInteger} [options.uid] - process user identity\n* @param {NonNegativeInteger} [options.gid] - process group identity\n* @param {NonNegativeInteger} [options.maxBuffer] - max child process `stdio` buffer size\n* @returns {(Error|null)} error or null\n*\n* @example\n* var opts = {};\n* var options = {\n* 'concurrency': 4,\n* 'workers': 2\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tif ( hasOwnProp( options, 'concurrency' ) ) {\n\t\topts.concurrency = options.concurrency;\n\t\tif ( !isPositiveInteger( opts.concurrency ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'concurrency', opts.concurrency ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'workers' ) ) {\n\t\topts.workers = options.workers;\n\t\tif ( !isPositiveInteger( opts.workers ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'workers', opts.workers ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'cmd' ) ) {\n\t\topts.cmd = options.cmd;\n\t\tif ( !isString( opts.cmd ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'cmd', opts.cmd ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'ordered' ) ) {\n\t\topts.ordered = options.ordered;\n\t\tif ( !isBoolean( opts.ordered ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'ordered', opts.ordered ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'uid' ) ) {\n\t\topts.uid = options.uid;\n\t\tif ( !isNonNegativeInteger( opts.uid ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`.', 'uid', opts.uid ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'gid' ) ) {\n\t\topts.gid = options.gid;\n\t\tif ( !isNonNegativeInteger( opts.gid ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`.', 'gid', opts.gid ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'maxBuffer' ) ) {\n\t\topts.maxBuffer = options.maxBuffer;\n\t\tif ( !isNonNegativeInteger( opts.maxBuffer ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`.', 'maxBuffer', opts.maxBuffer ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = validate;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar objectKeys = require( '@stdlib/utils-keys' );\nvar ENV = require( '@stdlib/process-env' );\n\n\n// FUNCTIONS //\n\n/**\n* Copies `process.env`.\n*\n* ## Notes\n*\n* - This implementation accommodates `process.env` on older Node.js versions (<=v0.10.x), where `process.env` was object-like, but would show unexpected behavior when attempting to get own property descriptors.\n*\n* @private\n* @returns {Object} copy of `process.env`\n*/\nfunction copy() {\n\tvar keys;\n\tvar env;\n\tvar out;\n\tvar i;\n\n\tkeys = objectKeys( ENV );\n\tout = {};\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\tenv = keys[ i ];\n\t\tout[ env ] = ENV[ env ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Returns worker environment variables.\n*\n* @private\n* @param {Options} opts - options\n* @param {string} opts.cmd - executable file/command\n* @param {boolean} opts.ordered - boolean indicating whether to preserve order of script output\n* @param {(NonNegativeInteger|null)} opts.uid - process user identity\n* @param {(NonNegativeInteger|null)} opts.gid - process group identity\n* @param {string} opts.encoding - `stdio` encoding\n* @param {NonNegativeInteger} opts.maxBuffer - max child process `stdio` buffer size\n* @returns {Object} environment variables\n*/\nfunction env( opts ) {\n\tvar out = copy();\n\n\tout.WORKER_CMD = opts.cmd;\n\tout.WORKER_ENCODING = opts.encoding;\n\tout.WORKER_MAX_BUFFER = opts.maxBuffer;\n\n\tif ( opts.ordered ) {\n\t\tout.WORKER_ORDERED = '1';\n\t}\n\tif ( opts.uid ) {\n\t\tout.WORKER_UID = opts.uid;\n\t}\n\tif ( opts.gid ) {\n\t\tout.WORKER_GID = opts.gid;\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = env;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar cwd = require( '@stdlib/process-cwd' );\nvar env = require( './env.js' );\n\n\n// MAIN //\n\n/**\n* Returns child process options.\n*\n* @private\n* @param {Options} options - worker options\n* @param {(NonNegativeInteger|null)} [options.uid] - process user identity\n* @param {(NonNegativeInteger|null)} [options.gid] - process group identity\n* @returns {Object} child process options\n*/\nfunction getOpts( options ) {\n\tvar opts = {\n\t\t'cwd': cwd(),\n\t\t'env': env( options ),\n\t\t'stdio': 'inherit' // Use stdio of parent process\n\t};\n\tif ( options.uid ) {\n\t\topts.uid = options.uid;\n\t}\n\tif ( options.gid ) {\n\t\topts.gid = options.gid;\n\t}\n\treturn opts;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOpts;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fork = require( 'child_process' ).fork;\nvar path = require( 'path' );\nvar logger = require( 'debug' );\nvar objectKeys = require( '@stdlib/utils-keys' );\nvar format = require( '@stdlib/string-format' );\nvar getOpts = require( './options.js' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'parallel:exec' );\nvar WORKER_FILEPATH = path.resolve( __dirname, './worker/index.js' );\n\n\n// FUNCTIONS //\n\n/**\n* Returns a callback to be invoked upon child process disconnect.\n*\n* @private\n* @param {Object} child - child process\n* @returns {Callback} callback\n*/\nfunction onDisconnect( child ) {\n\treturn listener;\n\n\t/**\n\t* Callback invoked upon child process disconnect.\n\t*\n\t* @private\n\t*/\n\tfunction listener() {\n\t\tdebug( 'Child process disconnected. pid: %d.', child.pid );\n\t}\n}\n\n\n// MAIN //\n\n/**\n* Executes scripts in parallel.\n*\n* @private\n* @param {StringArray} files - script absolute file paths\n* @param {Options} opts - options\n* @param {PositiveInteger} opts.concurrency - number of scripts to execute concurrently\n* @param {PositiveInteger} opts.workers - number of workers\n* @param {string} opts.cmd - executable file/command\n* @param {boolean} opts.ordered - boolean indicating whether to preserve order of script output\n* @param {(NonNegativeInteger|null)} opts.uid - process user identity\n* @param {(NonNegativeInteger|null)} opts.gid - process group identity\n* @param {string} opts.encoding - `stdio` encoding\n* @param {NonNegativeInteger} opts.maxBuffer - max child process `stdio` buffer size\n* @param {Callback} clbk - callback to invoke after executing all scripts\n*/\nfunction exec( files, opts, clbk ) {\n\tvar numClosed;\n\tvar workers;\n\tvar pending;\n\tvar fopts;\n\tvar args;\n\tvar proc;\n\tvar pids;\n\tvar pid;\n\tvar idx;\n\tvar err;\n\tvar FLG;\n\tvar i;\n\n\tFLG = false;\n\n\tdebug( 'Options: %s.', JSON.stringify( opts ) );\n\tnumClosed = 0;\n\n\tdebug( 'Creating %d workers...', opts.workers );\n\tworkers = {};\n\targs = [];\n\tfopts = getOpts( opts );\n\tfor ( i = 0; i < opts.workers; i++ ) {\n\t\tdebug( 'Creating child process...' );\n\t\tproc = fork( WORKER_FILEPATH, args, fopts );\n\n\t\tproc.on( 'error', onError( proc ) );\n\t\tproc.on( 'close', onClose( proc ) );\n\t\tproc.on( 'exit', onExit( proc ) );\n\t\tproc.on( 'disconnect', onDisconnect( proc ) );\n\t\tproc.on( 'message', onMessage( proc ) );\n\n\t\tdebug( 'Child process created. pid: %d.', proc.pid );\n\t\tworkers[ proc.pid ] = proc;\n\t}\n\tpids = objectKeys( workers );\n\tdebug( '%d workers created.', pids.length );\n\n\tdebug( 'Running %d scripts concurrently...', opts.concurrency );\n\tpending = {};\n\tidx = -1;\n\tfor ( i = 0; i < opts.concurrency; i++ ) {\n\t\tpid = pids[ i%pids.length ];\n\t\tnext( workers[ pid ] ); // eslint-disable-line node/callback-return\n\t}\n\n\t/**\n\t* Instructs a child process to run the next script.\n\t*\n\t* @private\n\t* @param {Object} child - child process\n\t* @returns {void}\n\t*/\n\tfunction next( child ) {\n\t\tvar numPending;\n\t\tidx += 1;\n\t\tif ( idx >= files.length ) {\n\t\t\tnumPending = objectKeys( pending ).length;\n\t\t\tif ( numPending > 0 ) {\n\t\t\t\tdebug( '%d scripts are pending.', numPending );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdebug( 'All scripts have finished.' );\n\t\t\treturn close();\n\t\t}\n\t\tdebug( 'Instructing child process to run script: %s. pid: %d.', files[ idx ], child.pid );\n\t\tchild.send( files[ idx ] );\n\t\tpending[ files[ idx ] ] = true;\n\n\t\tdebug( '%d of %d scripts have been processed.', idx, files.length );\n\t}\n\n\t/**\n\t* Returns a callback to be invoked upon receiving a message from a child process.\n\t*\n\t* @private\n\t* @param {Object} child - child process\n\t* @returns {Callback} callback\n\t*/\n\tfunction onMessage( child ) {\n\t\treturn listener;\n\n\t\t/**\n\t\t* Callback invoked upon receiving a message from a child process.\n\t\t*\n\t\t* @private\n\t\t* @param {string} filepath - script filepath\n\t\t*/\n\t\tfunction listener( filepath ) {\n\t\t\tdebug( 'Child process message: %s. pid: %d.', filepath, child.pid );\n\n\t\t\t// Remove the script from the listing of pending scripts:\n\t\t\tdelete pending[ filepath ];\n\n\t\t\t// Indicate that the child process is ready for its next task:\n\t\t\tnext( child );\n\t\t}\n\t}\n\n\t/**\n\t* Returns a callback to be invoked upon child process close.\n\t*\n\t* @private\n\t* @param {Object} child - child process\n\t* @returns {Callback} callback\n\t*/\n\tfunction onClose( child ) {\n\t\treturn listener;\n\n\t\t/**\n\t\t* Callback invoked upon child process close.\n\t\t*\n\t\t* @private\n\t\t* @param {(number|null)} code - exit code\n\t\t* @param {(string|null)} signal - termination signal\n\t\t*/\n\t\tfunction listener( code, signal ) {\n\t\t\tdebug( 'Child process closed. Code: %d. Signal: %s. pid: %d.', code, signal, child.pid );\n\t\t\tprocessExit( code, signal );\n\t\t\tchildClosed();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked if a child closes.\n\t*\n\t* @private\n\t*/\n\tfunction childClosed() {\n\t\tnumClosed += 1;\n\t\tdebug( '%d of %d child processes have closed.', numClosed, opts.workers );\n\t\tif ( numClosed === opts.workers ) {\n\t\t\tdone(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Returns a callback to be invoked upon child process exit.\n\t*\n\t* @private\n\t* @param {Object} child - child process\n\t* @returns {Callback} callback\n\t*/\n\tfunction onExit( child ) {\n\t\treturn listener;\n\n\t\t/**\n\t\t* Callback invoked upon child process exit.\n\t\t*\n\t\t* @private\n\t\t* @param {(number|null)} code - exit code\n\t\t* @param {(string|null)} signal - termination signal\n\t\t*/\n\t\tfunction listener( code, signal ) {\n\t\t\tdebug( 'Child process exited. Code: %d. Signal: %s. pid: %d.', code, signal, child.pid );\n\t\t\tprocessExit( code, signal );\n\t\t}\n\t}\n\n\t/**\n\t* Closes all workers.\n\t*\n\t* @private\n\t* @param {Error} [error] - error object\n\t*/\n\tfunction close( error ) {\n\t\tvar pids;\n\t\tvar pid;\n\t\tvar i;\n\n\t\tif ( FLG ) {\n\t\t\treturn;\n\t\t}\n\t\tFLG = true;\n\t\tif ( error && !err ) {\n\t\t\terr = error;\n\t\t}\n\t\tdebug( 'Instructing child processes to close...' );\n\t\tpids = objectKeys( workers );\n\t\tfor ( i = 0; i < pids.length; i++ ) {\n\t\t\tpid = pids[ i ];\n\t\t\tdebug( 'Instructing child process (pid: %d) to close...', pid );\n\t\t\tworkers[ pid ].send( 'close' );\n\t\t}\n\t}\n\n\t/**\n\t* Returns a callback to be invoked upon encountering a child process error.\n\t*\n\t* @private\n\t* @param {Object} child - child process\n\t* @returns {Callback} callback\n\t*/\n\tfunction onError( child ) {\n\t\treturn listener;\n\n\t\t/**\n\t\t* Callback invoked upon a child process error.\n\t\t*\n\t\t* @private\n\t\t* @param {Error} error - error object\n\t\t*/\n\t\tfunction listener( error ) {\n\t\t\tdebug( 'Child process error: %s. pid: %d.', error.message, child.pid );\n\t\t\tclose( error );\n\t\t}\n\t}\n\n\t/**\n\t* Processes process exit values. If provided a non-zero exit code or termination signal, instructs the process to close.\n\t*\n\t* @private\n\t* @param {(number|null)} code - exit code\n\t* @param {(string|null)} signal - termination signal\n\t* @returns {void}\n\t*/\n\tfunction processExit( code, signal ) {\n\t\tvar error;\n\t\tif ( err ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( code !== null && code !== 0 ) {\n\t\t\terror = new Error( format( 'unexpected error. Child process failed with exit code: `%u`.', code ) );\n\t\t} else if ( signal !== null ) {\n\t\t\terror = new Error( format( 'unexpected error. Child process failed due to termination signal: `%s`.', signal ) );\n\t\t}\n\t\tif ( error ) {\n\t\t\terror.code = code;\n\t\t\terror.signal = signal;\n\t\t\treturn close( error );\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once all tasks are finished.\n\t*\n\t* @private\n\t* @returns {void}\n\t*/\n\tfunction done() {\n\t\tif ( err ) {\n\t\t\treturn clbk( err );\n\t\t}\n\t\tclbk();\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = exec;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar exec = require( './exec.js' );\n\n\n// EXPORTS //\n\nmodule.exports = exec;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar resolve = require( 'path' ).resolve;\nvar isStringArray = require( '@stdlib/assert-is-string-array' ).primitives;\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar format = require( '@stdlib/string-format' );\nvar cwd = require( '@stdlib/process-cwd' );\nvar defaults = require( './defaults.js' );\nvar validate = require( './validate.js' );\nvar exec = require( './node' );\n\n\n// MAIN //\n\n/**\n* Executes scripts in parallel.\n*\n* @param {StringArray} files - script file paths\n* @param {Options} [options] - function options\n* @param {string} [options.cmd='node'] - executable file/command\n* @param {PositiveInteger} [options.concurrency] - number of scripts to execute concurrently\n* @param {PositiveInteger} [options.workers] - number of workers\n* @param {boolean} [options.ordered=false] - boolean indicating whether to preserve the order of script output\n* @param {NonNegativeInteger} [options.uid] - process user identity\n* @param {NonNegativeInteger} [options.gid] - process group identity\n* @param {NonNegativeInteger} [options.maxBuffer=200*1024*1024] - max child process `stdio` buffer size\n* @param {Callback} clbk - callback to invoke after executing all scripts\n* @throws {TypeError} first argument must be an array of strings\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} callback argument must be a function\n*\n* @example\n* var files = [ './a.js', './b.js ' ];\n*\n* var opts = {\n* 'workers': 3,\n* 'concurrency': 3\n* };\n*\n* function done( error ) {\n* if ( error ) {\n* console.log( error.message );\n* }\n* }\n*\n* parallel( files, opts, done );\n*/\nfunction parallel() {\n\tvar options;\n\tvar files;\n\tvar opts;\n\tvar clbk;\n\tvar err;\n\tvar dir;\n\tvar i;\n\n\tfiles = arguments[ 0 ];\n\tif ( !isStringArray( files ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array of strings. Value: `%s`.', files ) );\n\t}\n\tfiles = files.slice();\n\topts = defaults();\n\tif ( arguments.length > 2 ) {\n\t\toptions = arguments[ 1 ];\n\t\tclbk = arguments[ 2 ];\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t} else {\n\t\tclbk = arguments[ 1 ];\n\t}\n\tif ( !isFunction( clbk ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) );\n\t}\n\t// Prevent the number of concurrent scripts exceeding the number of actual scripts to run:\n\tif ( opts.concurrency > files.length ) {\n\t\topts.concurrency = files.length || 1;\n\t}\n\t// Prevent the number of workers exceeding the number of concurrent scripts (excess capacity), as some workers would never be allocated scripts to run and always be idle:\n\tif ( opts.workers > opts.concurrency ) {\n\t\topts.workers = opts.concurrency;\n\t}\n\t// Resolve any relative paths to absolute paths...\n\tdir = cwd();\n\tfor ( i = 0; i < files.length; i++ ) {\n\t\tfiles[ i ] = resolve( dir, files[ i ] );\n\t}\n\texec( files, opts, done );\n\n\t/**\n\t* Callback invoked after executing all scripts.\n\t*\n\t* @private\n\t* @param {Error} error - error object\n\t* @returns {void}\n\t*/\n\tfunction done( error ) {\n\t\tif ( error ) {\n\t\t\treturn clbk( error );\n\t\t}\n\t\tclbk();\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = parallel;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Execute scripts in parallel.\n*\n* @module @stdlib/utils-parallel\n*\n* @example\n* var parallel = require( '@stdlib/utils-parallel' );\n*\n* function done( error ) {\n* if ( error ) {\n* console.log( error.message );\n* }\n* }\n*\n* var files = [ './a.js', './b.js' ];\n* parallel( files, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
|
|
5
|
+
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cAsBA,IAAIC,EAAU,QAAS,qBAAsB,EACzCC,EAAM,QAAS,oCAAqC,EAexD,SAASC,IAAW,CACnB,IAAIC,EAGJ,OAAAA,EAAIF,EAAK,EAAGD,EAAU,CAAE,EAEjB,CAEN,QAAWG,EAGX,YAAeA,EAGf,IAAO,OAGP,QAAW,GAGX,IAAO,KAGP,IAAO,KAGP,SAAY,SAGZ,UAAa,IAAM,KAAO,IAC3B,CACD,CAKAJ,EAAO,QAAUG,KC1EjB,IAAAE,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cAsBA,IAAIC,GAAW,QAAS,gCAAiC,EACrDC,EAAa,QAAS,iCAAkC,EACxDC,EAAoB,QAAS,oCAAqC,EAAE,YACpEC,EAAuB,QAAS,uCAAwC,EAAE,YAC1EC,GAAY,QAAS,2BAA4B,EAAE,YACnDC,GAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAS,QAAS,uBAAwB,EA+B9C,S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D,EAAO,UAAW,CAAE,EAErB,GAAK,CAACV,GAAYU,CAAK,EACtB,MAAM,IAAI,UAAWT,EAAQ,uEAAwES,CAAK,CAAE,EAY7G,IATKD,EAAK,YAAcD,EAAM,SAC7BC,EAAK,YAAcD,EAAM,QAAU,GAG/BC,EAAK,QAAUA,EAAK,cACxBA,EAAK,QAAUA,EAAK,aAGrBG,EAAMV,GAAI,EACJW,EAAI,EAAGA,EAAIL,EAAM,OAAQK,IAC9BL,EAAOK,CAAE,EAAIf,GAASc,EAAKJ,EAAOK,CAAE,CAAE,EAEvCR,GAAMG,EAAOC,EAAMK,CAAK,EASxB,SAASA,EAAMC,EAAQ,CACtB,GAAKA,EACJ,OAAOL,EAAMK,CAAM,EAEpBL,EAAK,CACN,CACD,CAKAb,EAAO,QAAUS,KCzFjB,IAAIU,GAAO,IAKX,OAAO,QAAUA",
|
|
6
|
+
"names": ["require_defaults", "__commonJSMin", "exports", "module", "numCPUs", "max", "defaults", "n", "require_validate", "__commonJSMin", "exports", "module", "isObject", "hasOwnProp", "isPositiveInteger", "isNonNegativeInteger", "isBoolean", "isString", "format", "validate", "opts", "options", "require_env", "__commonJSMin", "exports", "module", "objectKeys", "ENV", "copy", "keys", "env", "out", "i", "opts", "require_options", "__commonJSMin", "exports", "module", "cwd", "env", "getOpts", "options", "opts", "require_exec", "__commonJSMin", "exports", "module", "fork", "path", "logger", "objectKeys", "format", "getOpts", "debug", "WORKER_FILEPATH", "onDisconnect", "child", "listener", "exec", "files", "opts", "clbk", "numClosed", "workers", "pending", "fopts", "args", "proc", "pids", "pid", "idx", "err", "FLG", "i", "onError", "onClose", "onExit", "onMessage", "next", "numPending", "close", "filepath", "code", "signal", "processExit", "childClosed", "done", "error", "require_node", "__commonJSMin", "exports", "module", "exec", "require_main", "__commonJSMin", "exports", "module", "resolve", "isStringArray", "isFunction", "format", "cwd", "defaults", "validate", "exec", "parallel", "options", "files", "opts", "clbk", "err", "dir", "i", "done", "error", "main"]
|
|
7
7
|
}
|
package/docs/types/index.d.ts
CHANGED
|
@@ -94,7 +94,7 @@ type Callback = Nullary | Unary;
|
|
|
94
94
|
*
|
|
95
95
|
* function done( error ) {
|
|
96
96
|
* if ( error ) {
|
|
97
|
-
*
|
|
97
|
+
* console.log( error.message );
|
|
98
98
|
* }
|
|
99
99
|
* }
|
|
100
100
|
*
|
|
@@ -127,7 +127,7 @@ declare function parallel( files: Array<string>, clbk: Callback ): void;
|
|
|
127
127
|
*
|
|
128
128
|
* function done( error ) {
|
|
129
129
|
* if ( error ) {
|
|
130
|
-
*
|
|
130
|
+
* console.log( error.message );
|
|
131
131
|
* }
|
|
132
132
|
* }
|
|
133
133
|
*
|
package/lib/defaults.js
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
// MODULES //
|
|
22
22
|
|
|
23
23
|
var numCPUs = require( '@stdlib/os-num-cpus' );
|
|
24
|
+
var max = require( '@stdlib/math-base-special-fast-max' );
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
// MAIN //
|
|
@@ -36,12 +37,17 @@ var numCPUs = require( '@stdlib/os-num-cpus' );
|
|
|
36
37
|
* // returns {...}
|
|
37
38
|
*/
|
|
38
39
|
function defaults() {
|
|
40
|
+
var n;
|
|
41
|
+
|
|
42
|
+
// Accommodate single-core systems by ensuring at least 1 worker and 1 concurrent script:
|
|
43
|
+
n = max( 1, numCPUs - 1 );
|
|
44
|
+
|
|
39
45
|
return {
|
|
40
46
|
// Number of workers:
|
|
41
|
-
'workers':
|
|
47
|
+
'workers': n,
|
|
42
48
|
|
|
43
49
|
// Number of scripts to execute concurrently:
|
|
44
|
-
'concurrency':
|
|
50
|
+
'concurrency': n,
|
|
45
51
|
|
|
46
52
|
// Executable file/command:
|
|
47
53
|
'cmd': 'node',
|
package/lib/index.js
CHANGED
package/lib/main.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
// MODULES //
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var resolve = require( 'path' ).resolve;
|
|
24
24
|
var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives;
|
|
25
25
|
var isFunction = require( '@stdlib/assert-is-function' );
|
|
26
26
|
var format = require( '@stdlib/string-format' );
|
|
@@ -60,7 +60,7 @@ var exec = require( './node' );
|
|
|
60
60
|
*
|
|
61
61
|
* function done( error ) {
|
|
62
62
|
* if ( error ) {
|
|
63
|
-
*
|
|
63
|
+
* console.log( error.message );
|
|
64
64
|
* }
|
|
65
65
|
* }
|
|
66
66
|
*
|
|
@@ -94,18 +94,18 @@ function parallel() {
|
|
|
94
94
|
if ( !isFunction( clbk ) ) {
|
|
95
95
|
throw new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) );
|
|
96
96
|
}
|
|
97
|
-
// Prevent the number of concurrent scripts exceeding the number of actual scripts to run
|
|
97
|
+
// Prevent the number of concurrent scripts exceeding the number of actual scripts to run:
|
|
98
98
|
if ( opts.concurrency > files.length ) {
|
|
99
|
-
opts.concurrency = files.length;
|
|
99
|
+
opts.concurrency = files.length || 1;
|
|
100
100
|
}
|
|
101
|
-
// Prevent the number of workers exceeding the number of concurrent scripts (excess capacity), as some workers would never be allocated scripts to run and always be idle
|
|
101
|
+
// Prevent the number of workers exceeding the number of concurrent scripts (excess capacity), as some workers would never be allocated scripts to run and always be idle:
|
|
102
102
|
if ( opts.workers > opts.concurrency ) {
|
|
103
103
|
opts.workers = opts.concurrency;
|
|
104
104
|
}
|
|
105
105
|
// Resolve any relative paths to absolute paths...
|
|
106
106
|
dir = cwd();
|
|
107
107
|
for ( i = 0; i < files.length; i++ ) {
|
|
108
|
-
files[ i ] =
|
|
108
|
+
files[ i ] = resolve( dir, files[ i ] );
|
|
109
109
|
}
|
|
110
110
|
exec( files, opts, done );
|
|
111
111
|
|
package/lib/node/exec.js
CHANGED
|
@@ -34,6 +34,29 @@ var debug = logger( 'parallel:exec' );
|
|
|
34
34
|
var WORKER_FILEPATH = path.resolve( __dirname, './worker/index.js' );
|
|
35
35
|
|
|
36
36
|
|
|
37
|
+
// FUNCTIONS //
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Returns a callback to be invoked upon child process disconnect.
|
|
41
|
+
*
|
|
42
|
+
* @private
|
|
43
|
+
* @param {Object} child - child process
|
|
44
|
+
* @returns {Callback} callback
|
|
45
|
+
*/
|
|
46
|
+
function onDisconnect( child ) {
|
|
47
|
+
return listener;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Callback invoked upon child process disconnect.
|
|
51
|
+
*
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
function listener() {
|
|
55
|
+
debug( 'Child process disconnected. pid: %d.', child.pid );
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
37
60
|
// MAIN //
|
|
38
61
|
|
|
39
62
|
/**
|
|
@@ -63,8 +86,11 @@ function exec( files, opts, clbk ) {
|
|
|
63
86
|
var pid;
|
|
64
87
|
var idx;
|
|
65
88
|
var err;
|
|
89
|
+
var FLG;
|
|
66
90
|
var i;
|
|
67
91
|
|
|
92
|
+
FLG = false;
|
|
93
|
+
|
|
68
94
|
debug( 'Options: %s.', JSON.stringify( opts ) );
|
|
69
95
|
numClosed = 0;
|
|
70
96
|
|
|
@@ -219,6 +245,11 @@ function exec( files, opts, clbk ) {
|
|
|
219
245
|
var pids;
|
|
220
246
|
var pid;
|
|
221
247
|
var i;
|
|
248
|
+
|
|
249
|
+
if ( FLG ) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
FLG = true;
|
|
222
253
|
if ( error && !err ) {
|
|
223
254
|
err = error;
|
|
224
255
|
}
|
|
@@ -231,26 +262,6 @@ function exec( files, opts, clbk ) {
|
|
|
231
262
|
}
|
|
232
263
|
}
|
|
233
264
|
|
|
234
|
-
/**
|
|
235
|
-
* Returns a callback to be invoked upon child process disconnect.
|
|
236
|
-
*
|
|
237
|
-
* @private
|
|
238
|
-
* @param {Object} child - child process
|
|
239
|
-
* @returns {Callback} callback
|
|
240
|
-
*/
|
|
241
|
-
function onDisconnect( child ) {
|
|
242
|
-
return listener;
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Callback invoked upon child process disconnect.
|
|
246
|
-
*
|
|
247
|
-
* @private
|
|
248
|
-
*/
|
|
249
|
-
function listener() {
|
|
250
|
-
debug( 'Child process disconnected. pid: %d.', child.pid );
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
265
|
/**
|
|
255
266
|
* Returns a callback to be invoked upon encountering a child process error.
|
|
256
267
|
*
|
package/lib/node/worker/spawn.js
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
var run = require( 'child_process' ).spawn;
|
|
24
24
|
var logger = require( 'debug' );
|
|
25
25
|
var cwd = require( '@stdlib/process-cwd' );
|
|
26
|
+
var format = require( '@stdlib/string-format' );
|
|
26
27
|
var proc = require( './process.js' );
|
|
27
28
|
|
|
28
29
|
|
|
@@ -133,9 +134,9 @@ function spawn( cmd, script, clbk ) {
|
|
|
133
134
|
return;
|
|
134
135
|
}
|
|
135
136
|
if ( code !== null && code !== 0 ) {
|
|
136
|
-
err = new Error(
|
|
137
|
+
err = new Error( format( '%s %s failed with exit code: %s.', cmd, script, code ) );
|
|
137
138
|
} else if ( signal !== null ) {
|
|
138
|
-
err = new Error(
|
|
139
|
+
err = new Error( format( '%s %s failed due to termination signal: %s.', cmd, script, signal ) );
|
|
139
140
|
}
|
|
140
141
|
if ( err ) {
|
|
141
142
|
err.code = code;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/utils-parallel",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Execute scripts in parallel.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -34,20 +34,22 @@
|
|
|
34
34
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@stdlib/assert-has-own-property": "^0.2.
|
|
38
|
-
"@stdlib/assert-is-boolean": "^0.2.
|
|
39
|
-
"@stdlib/assert-is-function": "^0.2.
|
|
40
|
-
"@stdlib/assert-is-nonnegative-integer": "^0.2.
|
|
41
|
-
"@stdlib/assert-is-plain-object": "^0.2.
|
|
42
|
-
"@stdlib/assert-is-positive-integer": "^0.2.
|
|
43
|
-
"@stdlib/assert-is-string": "^0.2.
|
|
44
|
-
"@stdlib/assert-is-string-array": "^0.2.
|
|
45
|
-
"@stdlib/
|
|
46
|
-
"@stdlib/
|
|
47
|
-
"@stdlib/process-
|
|
48
|
-
"@stdlib/
|
|
49
|
-
"@stdlib/
|
|
50
|
-
"
|
|
37
|
+
"@stdlib/assert-has-own-property": "^0.2.2",
|
|
38
|
+
"@stdlib/assert-is-boolean": "^0.2.2",
|
|
39
|
+
"@stdlib/assert-is-function": "^0.2.2",
|
|
40
|
+
"@stdlib/assert-is-nonnegative-integer": "^0.2.2",
|
|
41
|
+
"@stdlib/assert-is-plain-object": "^0.2.2",
|
|
42
|
+
"@stdlib/assert-is-positive-integer": "^0.2.2",
|
|
43
|
+
"@stdlib/assert-is-string": "^0.2.2",
|
|
44
|
+
"@stdlib/assert-is-string-array": "^0.2.2",
|
|
45
|
+
"@stdlib/math-base-special-fast-max": "^0.3.0",
|
|
46
|
+
"@stdlib/os-num-cpus": "^0.2.2",
|
|
47
|
+
"@stdlib/process-cwd": "^0.2.2",
|
|
48
|
+
"@stdlib/process-env": "^0.2.2",
|
|
49
|
+
"@stdlib/string-format": "^0.2.2",
|
|
50
|
+
"@stdlib/utils-keys": "^0.2.2",
|
|
51
|
+
"debug": "^2.6.9",
|
|
52
|
+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2"
|
|
51
53
|
},
|
|
52
54
|
"devDependencies": {},
|
|
53
55
|
"engines": {
|
|
@@ -92,7 +94,6 @@
|
|
|
92
94
|
"nodejs",
|
|
93
95
|
"node.js"
|
|
94
96
|
],
|
|
95
|
-
"__stdlib__": {},
|
|
96
97
|
"funding": {
|
|
97
98
|
"type": "opencollective",
|
|
98
99
|
"url": "https://opencollective.com/stdlib"
|