PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label django-celery. Show all posts
Showing posts with label django-celery. Show all posts

Monday, September 5, 2022

[FIXED] How to connect redis for celery to a django app deployed in digital ocean

 September 05, 2022     digital-ocean, django, django-celery, redis     No comments   

Issue

I hae recently deployed a django app in digitalocean. My app uses celery and redis for several email sending puposes and scheduled tasks. I have been searching for a documentation on how to connect redis and how to det the celery worker running for my app in digital ocean, but I am unable to find any proper way or documentation.

Please can someone tell me how to exactly setup this in digital ocean.


Solution

The django app would use the celery client to connect to redis like app = Celery('your App', broker='redis://localhost:6379/0') where the connection string points to your redis instance



Answered By - Asad Awadia
Answer Checked By - Timothy Miller (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Thursday, May 19, 2022

[FIXED] How to check task status in Celery?

 May 19, 2022     celery, django-celery, python, web-services     No comments   

Issue

How does one check whether a task is running in celery (specifically, I'm using celery-django)?

I've read the documentation, and I've googled, but I can't see a call like:

my_example_task.state() == RUNNING

My use-case is that I have an external (java) service for transcoding. When I send a document to be transcoded, I want to check if the task that runs that service is running, and if not, to (re)start it.

I'm using the current stable versions - 2.4, I believe.


Solution

Every Task object has a .request property, which contains it AsyncRequest object. Accordingly, the following line gives the state of a Task task:

task.AsyncResult(task.request.id).state


Answered By - Marcin
Answer Checked By - Senaida (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home
View mobile version

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing