Tuesday, January 28, 2014

How do I know if a celery task has crashed?

I have a model that looks something like this:

Job(models.Model):
    status = models.CharField(max_length=8, choices = statuses)
    jobid = models.CharField(max_length=20, db_index=True)
    ...

I submit tasks to celery.  The task fetches the Job object, changes its status to RUNNING, does the computation, then changes the status to FINISHED.  If the job crashes in my code I can catch the exception, set the status to ERROR and act accordingly, but if it crashes for some other reason I won't know it.  The only thing I can think of is to stop the celery queue, let it drain, and check the Job table for objects set to RUNNING.  Seems janky to me.  Is there a better way?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/aebae6cf-de7f-4920-8731-9ce8cfd0922e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment