cri_tasks.models module

class cri_tasks.models.CRITask(id, task_class, parameters, owner, task, status, created_at)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

FAILED = 'failed'
exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

NEW = 'new'
PENDING = 'pending'
RUNNING = 'running'
STATUS_CHOICES = (('new', 'New'), ('pending', 'Pending'), ('running', 'Running'), ('failed', 'Failed'), ('succeeded', 'Succeeded'))
SUCCEEDED = 'succeeded'
exception TaskError[source]

Bases: RuntimeError

created_at

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

get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
get_result_display()[source]
get_status_display(*, field=<django.db.models.fields.CharField: status>)
get_task_class()[source]
get_task_instance()[source]
hook(_task)[source]
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>
owner

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

owner_id
parameters

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

classmethod register_task_class(task_class)[source]
run(*_args, **_kwargs)[source]
save(*args, **kwargs)[source]

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

schedule()[source]
status

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

task

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

task_class

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

task_id