API reference

Progress Bars

A collection of progress bars you could use in projects

class django_celery_progressbar.bars.ProgressBar(task_id, total=100, step=None, dynamic=False, _getter=False)

Base progressbar class.

Parameters:
  • task_id (str.) – Unique task identifier.
  • total (int.) – Maximum progressbar value.
  • step (str.) – Verbose step name. I.e. ‘finding symbolic links’
  • dynamic (bool.) – Enable dynamic updates.
Raises:

ProgressBar.exceptions.OutOfRange, ProgressBar.exceptions.DoesNotExist

as_percent

Return current progress state in percents.

Returns:str – current progress in percents.
finalize()

Finalize progressbar, setting progress equal to total and Complete step.

Returns:None
classmethod get(task_id)

Get progressbar for a task.

Parameters:task_id (str.) – Unique task identifier.
Returns:ProgressBar object
progress

Return current bar progress.

Returns:int – current progress.
step

Return current bar step.

Returns:str – current step.
total

Return total bar value.

Returns:int – total value.
update(**kwargs)

Update progressbar state.

Parameters:
  • progress (int.) – Desired bar progress.
  • step (str.) – Desired bar step.
Returns:

None

Models

Models used by progress bars

class django_celery_progressbar.models.TaskProgress(*args, **kwargs)

The model is used as a temporary metadata storage for progressbar

exception DoesNotExist
exception MultipleObjectsReturned
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>
progress

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

step

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

task_id

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

total

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

Exceptions

Exceptions the package could throw

exception django_celery_progressbar.exceptions.DoesNotExist(task_id)

Raised when requested Celery task does not exist.

Param:task_id: Unique task identifier.
exception django_celery_progressbar.exceptions.OutOfRange

Raised when resulting progress is more than total value.