API Reference

Models

django_celery_logs.models.get_default_logs_expiration_days()[source]
class django_celery_logs.models.TaskConfig(id, logs_expiration_days)[source]

Bases: Model

logs_expiration_days

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod get_solo()[source]
exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

exception NotUpdated

Bases: ObjectNotUpdated, DatabaseError

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
class django_celery_logs.models.TaskLog(id, task_id, task_name, periodic_task_name, queue_name, worker, status, task_args, task_kwargs, result, duration_secs, error_message, traceback, timestamp)[source]

Bases: Model

class Status(*values)[source]

Bases: TextChoices

SUCCESS = 'SUCCESS'
FAILURE = 'FAILURE'
task_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

task_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

periodic_task_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

queue_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

worker

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

task_args

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

task_kwargs

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

result

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

duration_secs

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

error_message

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

traceback

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

timestamp

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

exception NotUpdated

Bases: ObjectNotUpdated, DatabaseError

get_next_by_timestamp(*, field=<django.db.models.fields.DateTimeField: timestamp>, is_next=True, **kwargs)
get_previous_by_timestamp(*, field=<django.db.models.fields.DateTimeField: timestamp>, is_next=False, **kwargs)
get_status_display(*, field=<django.db.models.fields.CharField: status>)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
class django_celery_logs.models.TaskLogStatistics(id, task_id, task_name, periodic_task_name, queue_name, worker, status, task_args, task_kwargs, result, duration_secs, error_message, traceback, timestamp)[source]

Bases: TaskLog

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

exception NotUpdated

Bases: NotUpdated

Tasks

Utilities

django_celery_logs.utils.clean_locals(locals_dict, safe_types=(<class 'str'>, <class 'int'>, <class 'float'>, <class 'bool'>, <class 'NoneType'>))[source]
django_celery_logs.utils.get_contextual_traceback()[source]
django_celery_logs.utils.get_periodic_task_name(request)[source]
django_celery_logs.utils.sort_dict_recursively(obj)[source]
django_celery_logs.utils.parse_duration_to_seconds(value)[source]
django_celery_logs.utils.create_task_log(sender=None, exception=None, result=None, **kwargs)[source]
django_celery_logs.utils.acquire_lock_or_fail(task_instance, lock_key, timeout=270, logger=None)[source]
Parameters:
  • task_instance (Any)

  • lock_key (str)

  • timeout (int)

  • logger (Any)

Return type:

Dict | None

Widgets

class django_celery_logs.widgets.PrettyJSONWidget(attrs=None)[source]
format_value(value)[source]

Return a value as it should appear when rendered in a template.

property media

App Config

class django_celery_logs.apps.CeleryLogsConfig(app_name, app_module)[source]
default_auto_field = 'django.db.models.BigAutoField'
name = 'django_celery_logs'
label = 'celery_log'
verbose_name = 'Celery Task Logs'
ready()[source]

Override this method in subclasses to run code when Django starts.