Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

299
Views
How to use Celery to do asynchronous tasks AWS EC2?

We set up an asynchronous task using Django, celery and rabbitMQ. Here our goal is to perform tasks like video transcoding, Thumbnail generation, Image compression and Image scaling altogether

We followed the below tutorial to implement it and the asynchronous task is working properly in Localhost. For the production compatibility, we used supervisord to start celery workers and to restart in case of system reboot or crash.

http://michal.karzynski.pl/blog/2014/05/18/setting-up-an-asynchronous-task-queue-for-django-using-celery-redis/

When we tried to implement same in AWS EC2, we are unable to install and configure Supervisord in AWS EC2.so we have to start celery manually every time. Can anyone please help us how to install and how to handle this procedure on AWS EC2

The code we are using

task.py
from __future__ import absolute_import
from test_celery.celery import app
import time

@app.task
def longtime_add(x, y):
print 'long time task begins'
# sleep 5 seconds
time.sleep(5)
print 'long time task finished'
return x + y

celery.py
from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
import afnity.settings as settings
from django.conf import settings


os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proj.settings')


app = Celery('taskapp')

app.config_from_object('django.conf:settings')

if __name__ == '__main__':
app.start() 

settings.py

BROKER_URL = 'amqp://guest:guest@localhost//'
CELERY_RESULT_BACKEND = 'redis://%s:%d/%d' % ('localhost', 6379, 0)
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!