# Path: carrot/exceptions.py
# class CarrotConfigException(Exception):
#     pass


from django.db import models
from django.core.validators import MinValueValidator
    from django.core.urlresolvers import reverse
    from django.urls import reverse
from carrot.exceptions import CarrotConfigException
from typing import Optional, Iterable
        from carrot.utilities import get_host_from_name
        from carrot.utilities import publish_message
        from carrot.utilities import publish_message
import json
import os
import sys
        import ast
        ('IN_PROGRESS', 'In progress'),
        ('FAILED', 'Failed'),
        ('COMPLETED', 'Completed'),
    ) #:

    status = models.CharField(max_length=11, choices=STATUS_CHOICES, default='PUBLISHED')
    exchange = models.CharField(max_length=200, blank=True, null=True)  #: the exchange
    queue = models.CharField(max_length=200, blank=True, null=True)
    routing_key = models.CharField(max_length=200, blank=True, null=True)
    uuid = models.CharField(max_length=200)
    priority = models.PositiveIntegerField(default=0)

    task = models.CharField(max_length=200)  #: the import path for the task to be executed
    task_args = models.TextField(null=True, blank=True, verbose_name='Task positional arguments')
    content = models.TextField(null=True, blank=True, verbose_name='Task keyword arguments')

    exception = models.TextField(null=True, blank=True)
    traceback = models.TextField(null=True, blank=True)
    output = models.TextField(null=True, blank=True)

    publish_time = models.DateTimeField(null=True, blank=True)
    failure_time = models.DateTimeField(null=True, blank=True)
    completion_time = models.DateTimeField(null=True, blank=True)

    log = models.TextField(blank=True, null=True)

    @property
    def virtual_host(self) -> Optional[str]:
        try:
            return str(get_host_from_name(self.queue))

# Path: carrot/exceptions.py
# class CarrotConfigException(Exception):
#     pass


# Path: carrot/models.py
from django.db import models
from django.core.validators import MinValueValidator
    from django.core.urlresolvers import reverse
    from django.urls import reverse
from carrot.exceptions import CarrotConfigException
from typing import Optional, Iterable
        from carrot.utilities import get_host_from_name
        from carrot.utilities import publish_message
        from carrot.utilities import publish_message
import json
import os
import sys
        import ast

        ('IN_PROGRESS', 'In progress'),
        ('FAILED', 'Failed'),
        ('COMPLETED', 'Completed'),
    ) #:

    status = models.CharField(max_length=11, choices=STATUS_CHOICES, default='PUBLISHED')
    exchange = models.CharField(max_length=200, blank=True, null=True)  #: the exchange
    queue = models.CharField(max_length=200, blank=True, null=True)
    routing_key = models.CharField(max_length=200, blank=True, null=True)
    uuid = models.CharField(max_length=200)
    priority = models.PositiveIntegerField(default=0)

    task = models.CharField(max_length=200)  #: the import path for the task to be executed
    task_args = models.TextField(null=True, blank=True, verbose_name='Task positional arguments')
    content = models.TextField(null=True, blank=True, verbose_name='Task keyword arguments')

    exception = models.TextField(null=True, blank=True)
    traceback = models.TextField(null=True, blank=True)
    output = models.TextField(null=True, blank=True)

    publish_time = models.DateTimeField(null=True, blank=True)
    failure_time = models.DateTimeField(null=True, blank=True)
    completion_time = models.DateTimeField(null=True, blank=True)

    log = models.TextField(blank=True, null=True)

    @property
    def virtual_host(self) -> Optional[str]:
        try:
            return str(get_host_from_name(self.queue))

        except CarrotConfigException: