| 33 | |
| 34 | module.exports = { |
| 35 | init() { |
| 36 | debug('init()'); |
| 37 | if (!config.useWorkers) { |
| 38 | return; |
| 39 | } |
| 40 | var numWorkers = config.workersCount; |
| 41 | if (numWorkers == null) { |
| 42 | numWorkers = Math.ceil(config.workersPerCpu * os.cpus().length); |
| 43 | } |
| 44 | for (let i = 0; i < numWorkers; i++) { |
| 45 | const pc = new codeCaller.PythonCaller(); |
| 46 | pc.number = i; |
| 47 | pythonCallers.push(pc); |
| 48 | load.startJob('python_worker_idle', pc.uuid); |
| 49 | availablePythonCallers.push(pc); |
| 50 | } |
| 51 | module.exports._warmUpWorkers(); |
| 52 | }, |
| 53 | |
| 54 | finish(callback) { |
| 55 | debug('finish()'); |