npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

echelon

v0.1.0

Published

A distributed work queue built on Espial

Downloads

9

Readme

echelon

##About

###Description Echelon is a distributed work queue built on Espial.

Echelon uses the master Espial node to distribute jobs to slave nodes. Slave nodes perform computation and return results to the master node. The registration of custom handlers allow for different types of jobs to be handled by the same cluster. More to come!

###Author

##Getting Started

###Installation npm install echelon

###Configuration To get running, require echelon and instantiate a new Echelon object. When you are ready to start the node, simply call echelon.init() and pass configuration options and a callback. For example:

var Echelon = require("echelon");
var echelon = new Echelon();

var options = {
    concurrency: 4,
    espial: {}
}

echelon.init(options, function(){
    console.log("node started!");
});
  • espial: (optional) Object passed to Espial for configuration. See Espial documentation for more information.
  • concurrency: (optional) The number of concurrent jobs this node can process.

##Features

###Distributed Job Processing Echelon serves as a distributed work queue, responsible for performing job processing. The Espial master node is responsible for distributing jobs to worker nodes. The master node never processes jobs, but rather manages the job queue, job distribution, and so on. Each node has the ability to specify the number of concurrent jobs it can process during configuration, as seen above. By running a cluster of nodes, a greater amount of jobs can be processed in parallel, significantly reducing processing time. Given that Echelon is a module, it is quite extensible and can be used in a wide variety of applications.

###Default Handlers Echelon comes with two default handlers: on_success and on_failure. When a job is finished it will execute one of these callbacks dependant upon whether it was successfully processed or not. By default, Echelon simply logs whether the job was successful or not to the console. These handlers can be overriden. More on custom handlers below.

###Custom Handlers Handlers are responsible for performing the work necessary to "complete" a job. The schema of a Job object contains a handler key, which specifies which handler to use to process the job. An example job may look like:

var job = {
    handler: "my_first_handler",
    data: {
        some: "data",
        can: ["go, "here"]
    }
}

To process the above job, a handler must be registered on worker nodes for "my_first_handler". To register a new handler, simple call add_handler() as seen below:

echelon.add_handler("my_first_handler", function(data, fn){
    return fn({
        success: true,
        attribute: [data.some, can.length].join(" ");
    });
});

Obviously this is an extremely simplified example of job processing; however, it is evident how a handler could be extended to perform powerful processing.

The fn() callback returns a custom object which will be sent back to the master (distributor) node. The success attribute specifies whether the job was successfully processed or not. If the success key is omitted, it defaults to true.

Pushing Jobs

To push the example job above, use the echelon.add_job() method. Simply pass the job object as the parameter:

var job = {
    handler: "my_first_handler",
    data: {
        some: "data",
        can: ["go, "here"]
    }
}

echelon.add_job(job);

Jobs can be added from any node in the cluster (not only the master).