Seneca plugin
seneca-run - aSeneca Run Plugin
This plugin runs and manages external processes. It maintains a table of named processes and process options.
The batch-process module is used to execute the external processes. Refer to that module for the options to use in the batch option below. Note that that module generates log files on disk, which you will need to cleanup periodically in production.
The status of running processes are provided via the role:run,info:report pattern, which you should implement using seneca.add.
For a gentle introduction to Seneca itself, see the senecajs.org site.
If you're using this plugin module, feel free to contact me on twitter if you have any questions! :) @rjrodger
Current Version: 0.1.1
Tested on: Seneca 0.5.20, Node 0.10.31
Install
To install:
npm install seneca-run
Quick Example
var seneca = // subscribe to the reporting patternseneca seneca
Usage
Define your batch processes as options to the plugin. Then call the pattern role:run,cmd:execute to run them. The result object contains a procid field which you can use to query the status of a process with the role:run,cmd:query,procid:? pattern.
To receive reports of the status as it runs, subscribe to the role:run,info:report pattern. This will give you reports of all running processes. To narrow it down to one process, include the name of the process in the pattern:
// see test/npm-all.jsseneca
For usage in a micro-service context, see nodezoo-npm-all.
Options
The options are:
- batch: Object. Keys are the names of processes. Values are options for batch-process.
Testing
Unit tests use mocha, and can be run with:
npm test
For detailed logging, use:
SENECA_LOG=all npm test
Releases
- 0.1.0: initial release