Giter Club home page Giter Club logo

yerbie's Introduction

Yerbie

CI Release

Yerbie is a job queue and scheduler backed by Redis. Yerbie is used for:

  • Distributing work across threads or machines
  • Scheduling code to run sometime in the future
  • Retrying failures asynchronously

... and more! To learn more about Yerbie, go to the official Yerbie website.

This repository contains code for the Yerbie server. The Yerbie server manages job data, queues and job schedules in Redis while exposing an API for clients to interface with Yerbie.

Yerbie API

The following describes the Yerbie API with sample HTTP requests. Client libraries will send these requests to interact with Yerbie, however client libraries are still responsible for also handing errors, serializing and deserializing job data, as well as implementing polling and running jobs from the Yerbie server.

Create Job

This creates a job to be scheduled by Yerbie with a certain delay to a specific queue.

Body JSON Parameters:

  • delaySeconds - amount of seconds to delay the job before it becomes available in the queue
  • jobData - serialized job payload string.
  • queue - queue name for which this job should go to.
  • jobToken - the client generated job token.
curl -H "Content-Type: application/json" -X POST -d '{JSON_BODY}' localhost:5865/jobs/schedule

Sample Request

  curl -H "Content-Type: application/json" -X POST -d '{"jobData":"JOB_DATA","delaySeconds":5,"queue":"high_priority_queue","jobToken":"token"}' localhost:5865/jobs/schedule 

Sample Response

  {"jobToken":"token","queue":"high_priority_queue","jobData":"JOB_DATA","delaySeconds":5}

Reserve Job

This requests a job from Yerbie to indicate that it is being processed by a client. Yerbie will mark this job as running, and the client must tell Yerbie that it has finished with the job, otherwise Yerbie will enqueue the job again after 10 seconds.

curl -X POST "localhost:5865/jobs/reserve/{queue_name}"

Sample Request

  curl -X POST "localhost:5865/jobs/reserve/high_priority_queue"

Sample Response

  {"delaySeconds":5,"jobData":"JOB_DATA","queue":"high_priority_queue","jobToken":"token"}

Finish Job

This tells Yerbie that the client has finished processing the job. Yerbie will not enqueue the job again.

  curl -X POST "localhost:5865/jobs/finished/{token}"

Sample Request

  curl -X POST "localhost:5865/jobs/finished/token"

Sample Response

  {"jobToken":"token"}

Delete Job

This will delete a job that hasn't already been put onto a queue. If the job is already on a queue, it will not be deleted.

  curl -X POST "localhost:5865/jobs/delete/{token}"

Sample Request

  curl -X POST "localhost:5865/jobs/delete/token"

Sample Response

  {"jobToken":"token"}

Local Development

See DEVELOPING.md.

yerbie's People

Contributors

claudiowilson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.