Worker
As the name itself states it , Worker is the task processor node. After initial connection , Worker waiting for new tasks.
Info needs from Master :
- token
- transferEncryptToken
These 2 tokens are generated in Master due setup.Worker can operate in any network condition as long is online, can work behind NAT or home routers. Using webrtc and peer to peer trackers to connect and communicate with master.
Can receive task assets and their dependencies , while can track any changes made in files shared from Master ,if has outdated version of those files , will request again latest ones from Master.Dependencies automatically installed when a file change takes place.
Can receive job data , as part of job if Master passes them.And finally send back to Master job results , all data communication are encrypted.
Get started
With npm
yarn add queue-xec-worker
Including in existing project
const Worker = require('queue-xec-worker')
const work1 = new Worker({
token,
name = 'worker_1',
loglevel,
transferEncryptToken = null,
});
** file an issue if you think Worker should expose any other functionalities (for example, to have more control) .
git clone https://github.com/queue-xec/worker
cd worker
yarn
node worker.js --setup
Will prompt user to enter following info:
- transferEncryptToken token from master to secure data communications
- token from master this used for peers connection through webrtc.
These info will saved and loaded (later) in .env file at root workers folder.
Run and Wait for jobs :
> Contributors <
⚠️ Under development ⚠️