beat.web.backend.models.queue module

class beat.web.backend.models.queue.QueueManager[source]

Bases: django.db.models.manager.Manager

get_by_natural_key(name)[source]
class beat.web.backend.models.queue.Queue(id, name, memory_limit, time_limit, cores_per_slot, max_slots_per_user)[source]

Bases: django.db.models.base.Model

name

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

memory_limit

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

time_limit

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

cores_per_slot

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

max_slots_per_user

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

environments

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <beat.web.backend.models.queue.QueueManager object>
natural_key()[source]
get_admin_change_url()[source]
number_of_slots()[source]

Total number of slots considering all assigned worker/slots

availability()[source]

Returns the availability for this queue in terms of number of slots

This method does not take into consideration the occupation of this queue slots caused by jobs on other queues. It only looks to its inner occupancy and reports on that.

Returns an integer between 0 and Queue.slots().

worker_availability()[source]
Returns an ordered dictionary indicating the availability of workers

according to their queue priority.

The dictionary contains, as value, the number of slots available per worker

The order of workers is sorted by:

  • slot priority (the higher, the better)

  • load (the lower, the better)

  • name (alphabetically)

splits()[source]

Lists all job splits currently associated to this queue

as_dict()[source]

Returns a representation as a dictionary

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

blocks

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

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

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

id

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

slots

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

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

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.