Package Exports
- orchestrator
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (orchestrator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Orchestrator
A module for sequencing and executing tasks and dependencies in maximum concurrency
Usage
1. Get a reference:
var Orchestrator = require('orchestrator');
var orchestrator = new Orchestrator();
2. Load it up with stuff to do:
A synchronous task:
orchestrator.add('thing1', function(){
// do stuff
});
An asynchronous task:
orchestrator.add('thing2', function(callback){
// do stuff
callback(err);
});
An asynchronous task using promises:
var Q = require('q');
orchestrator.add('thing3', function(){
var deferred = Q.defer();
// do async stuff
setTimeout(function () {
deferred.resolve();
}, 1);
return deferred.promise;
});
A task that requires other tasks be done first:
orchestrator.add('thing4', ['thing1','thing2','thing3'], function(){
// do stuff
});
3. Run the tasks:
Specify the tasks you want to run:
orchestrator.run('thing1','thing2','thing3', 'thing4');
or run all the tasks:
orchestrator.run();
specify a callback to run when all tasks are complete:
orchestrator.run('thing1', function (err) {
// all done
});
FRAGILE: Orchestrator catches exceptions on sync runs to pass to your callback but doesn't hook to process.uncaughtException so it can't pass those exceptions to your callback
4. Enjoy!
LICENSE
(MIT License)
Copyright (c) 2013 Richardson & Sons, LLC
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.