GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - queue-xec/worker: Worker part of queue-xec , can runs jobs - install required dependencies dynamically on demand.All required data with master exchanged with encryption.

BranchesTags
Open more actions menu

Latest commit

 

History

37 Commits
37 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
.husky
.husky
 
 
example
example
 
 
src
src
 
 
.editorconfig
.editorconfig
 
 
.eslintrc.js
.eslintrc.js
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
.prettierrc
.prettierrc
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
env.sample
env.sample
 
 
index.js
index.js
 
 
lint-staged.config.js
lint-staged.config.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
worker.js
worker.js
 
 
yarn.lock
yarn.lock
 
 

Repository files navigation

Worker

Publish to NPM

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  #or# npm install queue-xec-worker

Including in existing project

const Worker = require('queue-xec-worker')

const work1 = new Worker({
    token, // token generated from Master
    name = 'worker_1',
    loglevel, // off -> info -> warn -> error -> debug
    transferEncryptToken = null, // token generated from Master
    }); // work1 instance is ready for incoming new tasks

** 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 #or# npm install
 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 :

  • node worker.js

Task File Structure

The worker expects a task.js file to be provided by the Master. This file should export a class with a run method that accepts a job object as an argument and returns a Promise that resolves with the job's results.

Example task.js:

class Task {
  async run(job) {
    // Process the job data
    console.log('Processing job:', job.id);
    // ... perform some work ...
    return {
      jobId: job.id,
      status: 'completed',
      result: 'some_result',
    };
  }
}

module.exports = Task;

MIT License

> Contributors <

⚠️ Under development ⚠️

About

Worker part of queue-xec , can runs jobs - install required dependencies dynamically on demand.All required data with master exchanged with encryption.

Topics

distributed-queuedistributed-systemsdistributed-task-processingqueuexectask-queue

Resources

Readme
MIT license
Activity
Custom properties

Stars

7 stars

Watchers

0 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.