Coder Social home page Coder Social logo

learning-celery's Introduction

Learning celery

Simple repository designed to learn and test celery related stuff.

Prerequisites

At the bare minimum you'll need the following for your development environment:

  1. Python 3.6
  2. pyenv
  3. pyenv-virtualenv or virtualenv
  4. Docker
  5. Docker Compose

Getting Started

Cloning

$ git clone [email protected]:phillipemoreira/learning-celery.git
$ cd learning-celery

Setting up python virtual environment

$ pyenv install 3.6.1
$ pyenv virtualenv 3.6.1 learning-celery
$ pyenv local learning-celery

Errors

If you receive one error of missing OpenSSL to run the pyenv install, you can try to fix running:

$ sudo apt install -y libssl1.0-dev

Installation

$ make install

Running

Celery requires a message broker and this project uses RabbitMQ (celery's default), but it does not require you to install in your host machine, it creates a docker container defined in the docker-compose configuration file. Therefore you are going to need to terminal instances, one for running the message broker, and another one for running the celery project itself.

RabbitMQ

On the first terminal instance:

$ docker-compose up

This will pull the docker image, setup and start a RabbitMQ Server.

Celery

on the second terminal instance:

$ cd app
$ celery -A tasks worker --loglevel=info

Testing

$ python
$ from tasks import add
$ add.delay(4, 4)

Expected result: The task has now been processed by the worker you started earlier and the result is available in console output. ex:

[2018-11-11 17:53:32,999: INFO/ForkPoolWorker-2] Task tasks.add[93a446f4-71e6-456d-b77d-32d5585f308e] succeeded in 0.0004594189813360572s: 8

learning-celery's People

Contributors

phillipemoreira 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.