django-carrot models

class carrot.models.MessageLog(*args, **kwargs)

MessageLogs store information about a carrot task

Lifecycle:
  1. A carrot.objects.Message object is created and published.
  2. The act of publishing the message creates a MessageLog object with the status ‘PUBLISHED’. The task now sits in the RabbitMQ queue until it has been consumed
  3. When a consumer digests the message, the status is updated to ‘COMPLETED’ if the task completes successfully or ‘FAILED’ if it encounters an exception. The output, traceback, exception message and logs are written back to the MessageLog object
  4. If a task has failed, it can be requeued. Requeueing a task will create a new carrot.objects.Message object with the same parameters. In this case, the originally MessageLog object will be deleted
  5. If the task has been completed successfully, it will be deleted three days after completion, provided that the :function:`carrot.helper_tasks.cleanup` has not been disabled
exception DoesNotExist
exception MultipleObjectsReturned
STATUS_CHOICES = (('PUBLISHED', 'Published'), ('IN_PROGRESS', 'In progress'), ('FAILED', 'Failed'), ('COMPLETED', 'Completed'))
exchange

the exchange

keywords

Used in carrot.views.MessageView to display the keyword arguments as a table

requeue()

Sends a failed MessageLog back to the queue. The original MessageLog is deleted

task

the import path for the task to be executed

class carrot.models.ScheduledTask(*args, **kwargs)

A model for scheduling tasks to run at a certain interval

exception DoesNotExist
exception MultipleObjectsReturned