Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8015987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:24:56+00:00 2026-06-04T20:24:56+00:00

I am writing a small test task for django-celery, in which I would like

  • 0

I am writing a small test task for django-celery, in which I would like to set a custom state (and some data, but let’s start with a custom state first).

I use django as the messaging backend. My version of python is 2.6.

Here’s the content of tasks.py

import time
from djcelery import celery

@celery.task
def generate():
    generate.update_state(state="PROGRESS")
    time.sleep(10)
    return True

And here’s what happens when I give it a try:

>>> import tasks
>>> result = tasks.generate.delay()
>>> result
<AsyncResult: f72574aa-f8c5-49dc-89d4-47d2012a4d6d>

# status and state are the same, but just to make sure
>>> result.status
u'PENDING'
>>> result.state
u'PENDING'
>>> result.result
# empty, as in None

# wait a few seconds
>>> result.status
u'SUCCESS'
>>> result.state
u'SUCCESS'
>>> result.result
True

I can’t figure out why the state is PENDING while it should be PROGRESS. Any idea?

I’ve already looked at the documentation, and here’s the relevant link: http://docs.celeryproject.org/en/latest/userguide/tasks.html#custom-states

I do the exact same thing (minus the meta, but I also tried without success), so it should work.

UPDATE: I found out why, looks like you have to restart the celery daemon whenever you update your tasks so that the changes are taken into account.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:24:57+00:00Added an answer on June 4, 2026 at 8:24 pm

    I found out why, looks like you have to restart the celery daemon whenever you update your tasks so that the changes are taken into account.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a small wxPython utility. I would like to use some event
I am writing a small app, like an English multiple choices question test .
I have a small test application I'm writing in Java to parse some JSON
I am writing a small app which I need to test with utf-8 characters
I have an application where I am reading and writing small blocks of data
I'm writing a small program to record reading progress, the data models are simple:
I've been writing some small maintenance/viewer tools that each connect to a SQLServer (2005)
I am writing a small test program that gives the following xml file as
I am currently writing a small graphical performance test benchmark for JavaFX. Thus, I
I am writing a test application which is controlling another computer. The test computer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.