beat.web.backend.models package

Module contents

class beat.web.backend.models.Environment(*args, **kwargs)[source]

Bases: beat.web.common.models.Shareable

Defines a software environment to run algorithms

name

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

version

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

short_description

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

description

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

creation_date

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

active

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

previous_version

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.

objects = <beat.web.backend.models.environment.EnvironmentManager object>
natural_key()[source]
fullname()[source]
get_absolute_url()[source]
get_admin_change_url()[source]
queues_for(user)[source]

Returns all queues associated to this environment for which the user has the ‘can_access’ permission

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.

get_next_by_creation_date(*, field=<django.db.models.fields.DateTimeField: creation_date>, is_next=True, **kwargs)
get_previous_by_creation_date(*, field=<django.db.models.fields.DateTimeField: creation_date>, is_next=False, **kwargs)
get_sharing_display(*, field=<django.db.models.fields.CharField: sharing>)
id

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

languages

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.

next_versions

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.

previous_version_id
queues

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.

shared_with

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.

shared_with_team

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.

class beat.web.backend.models.EnvironmentLanguage(id, environment, language)[source]

Bases: django.db.models.base.Model

environment

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.

language

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: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

environment_id
get_language_display(*, field=<django.db.models.fields.CharField: language>)
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 beat.web.backend.models.EnvironmentManager[source]

Bases: beat.web.common.models.ShareableManager

get_by_natural_key(name, version)[source]
get_by_fullname(fullname)[source]
use_count(block_list)[source]

Returns a list of environments used for the blocks in that list with how many times each has been used.

Parameters

block_list (Block) – list of blocks to analyze.

Returns

annotated environments with the number of time they have been

used for blocks that are done.

Return type

list

class beat.web.backend.models.Job(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Class describing the execution of a Job on the backend

block

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.

result

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.

runnable_date

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

start_date

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

end_date

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

key

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

mirror

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

objects = <beat.web.backend.models.job.JobManager object>
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

block_id
id

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

result_id
splits

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.

class beat.web.backend.models.JobSplit(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Class describing a part of job of an experiment

QUEUED = 'N'
PROCESSING = 'P'
COMPLETED = 'C'
FAILED = 'F'
CANCELLED = 'L'
CANCELLING = 'K'
STATUS = (('N', 'Queued'), ('P', 'Processing'), ('C', 'Completed'), ('F', 'Failed'), ('L', 'Cancelled'), ('K', 'Cancelling'))
worker

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.

job

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.

split_index

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

start_index

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

end_index

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.

result

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.

start_date

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

end_date

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

objects = <beat.web.backend.models.job.JobSplitManager object>
done()[source]

Says whether the job has finished or not

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

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.

job_id
result_id
worker_id
class beat.web.backend.models.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.

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

Bases: django.db.models.manager.Manager

get_by_natural_key(name)[source]
class beat.web.backend.models.Result(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Logging and status information concerning block or job execution.

status

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

stdout

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

stderr

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

usrerr

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

timed_out

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

cancelled

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

property stats
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

id

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

job

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

In the example:

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

Place.restaurant is a ReverseOneToOneDescriptor instance.

objects = <django.db.models.manager.Manager object>
split

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

In the example:

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

Place.restaurant is a ReverseOneToOneDescriptor instance.

class beat.web.backend.models.Slot(id, queue, worker, quantity, priority)[source]

Bases: django.db.models.base.Model

queue

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.

worker

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.

quantity

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

priority

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

objects = <beat.web.backend.models.slot.SlotManager object>
natural_key()[source]
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

id

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

queue_id
worker_id
class beat.web.backend.models.SlotManager[source]

Bases: django.db.models.manager.Manager

get_by_natural_key(queue_name, worker_name)[source]
class beat.web.backend.models.Worker(id, name, active, update, updated, cores, memory, used_cores, used_memory, info)[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.

active

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

update

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

updated

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

cores

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

memory

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

used_cores

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

used_memory

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

info

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

objects = <beat.web.backend.models.worker.WorkerManager object>
natural_key()[source]
get_admin_change_url()[source]
load()[source]

Calculates the number of cores in use or to be used in the future

current_load()[source]

Calculates the number of cores being used currently

available_cores()[source]

Calculates the number of available cores considering current load

as_dict()[source]

Returns a dictionary-like representation

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

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.

splits

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.

class beat.web.backend.models.WorkerManager[source]

Bases: django.db.models.manager.Manager

get_by_natural_key(name)[source]