Giter Club home page Giter Club logo

celery-priority-tasking's Introduction

celery-priority-tasking

This is a prototype to schedule jobs in the backend based on some priority using Rabbitmq and Celery.

Video Transcoding Simulation

In this sample project, the powers of Celery and RabbitMQ in prioritized tasking can be seen. The simulation for transcoding a video to

  • 360p resolution takes 5 seconds
  • 480p resolution takes 10 seconds
  • 720p resolution takes 15 seconds
  • 1080p resolution takes 20 seconds

Of course this isn't even close to the real scencario, but it's good enough to observe the prioritized tasking.

To Enable Celery's Priority Tasking

These are the things to keep in mind to enable priority tasking without getting into trouble or unnecessary errors.

  • 'x-max-priority': 10 This argument must be provided to the queue so that RabbitMQ knows that tasks should be prioritized.
  • There is a possibility that the queue has no chance to prioritize the messages (because they get downloaded before the sorting happens). Prefetch multiplier is 4 by default.
CELERY_ACKS_LATE = True
CELERYD_PREFETCH_MULTIPLIER = 1

Execution

  • First, run pip install -r requirements.txt and go into the directory cd celery-priority-tasking/celery_sample_project.
  • Run python main.py for starting up Flask.
  • Then, in another terminal, run celery worker -c [number of workers] -A tasks -Q tasks --loglevel=info &.
  • Open up a browser and start simulating!

Preview

There is a small preview video here with only 1 Celery worker so that it's easy to observe the tasks getting sorted.

Install dependencies for RabbitMQ

To install dependencies on Debian machines, use the script provided or otherwise modify it accordingly for other operating systems.

Tutorials

celery-priority-tasking's People

Contributors

vijeth-aradhya avatar

Watchers

James Cloos 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.