Runs another NodeJS program in a seperate thread.
Creates a separate run thread (multithreading)
| Parameter | Type | Description |
|---|---|---|
| path | String | path to the file to run in the thread |
| onMessage | Function | action to complete when the thread sends a message using process.send(data) |
| onExit | Function | action to complete when the thread exits |
This is an object passed to the cluster worker. A cluster worker should be structured:
creates a cluster of threads
| Parameter | Type | Description |
|---|---|---|
| path | String | path to the file to run in the thread |
| input | Map | data to send to the threads. The key of the map cooresponds to the thread |
| onComplete | Function | action to complete when the thread exits (takes output of the cluster as a parameter) |
| threads | Int | [Optional, default is number of CPU cores the computer has] Number of threads for the cluster to create |