Giter Site home page Giter Site logo

autocelery_9bz9's Introduction

autocelery

autocelery adds a special Celery task to your Celery application that copies your current local code and environment to your workers, allowing you to declare and run Celery tasks using your local code without restarting your workers or reloading their code or modules.

Motivation

Reloading in basic Celery...

... is not supported. According to the Celery docs:

When tasks are sent, no actual function code is sent with it, just the name of the task to execute. When the worker then receives the message it can look up the name in its task registry to find the execution code.

This means that your workers should always be updated with the same software as the client. This is a drawback, but the alternative is a technical challenge that's yet to be solved.

This traditionally implies that you must declare your Celery tasks, deploy the code to your worker cluster, and start the cluster before you can run those tasks on that cluster.

Historically, Celery had an experimental --autoreload flag, but it was deprecated around v3.1 and officially removed in v4.0.

Why not use watchdog and watchmedo?

Some developers use watchdog and watchmedo to watch the local code directories for changes and restart Celery workers when something is changed, similar to gunicorn --reload or web frameworks like Flask or django in development.

However, you would not deploy this solution to production: it's a supervisor/orchestration solution and it would add nesting and complexity to your existing production service orchestration. Moreover, you would not want your production services to depend on local code (what does "local" mean in production, anyway?).

But you might want a version of auto-reloading in production if

  1. You have beefy machines running your prod worker cluster
  2. You are iterating on code that needs a beefy cluster to evaluate

Getting started

...

autocelery_9bz9's People

Contributors

arseniybanayev avatar trellixvulnteam 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.