Database models
Data models for the db application.
- class debusine.db.models.Artifact(*args, **kwargs)[source]
Bases:
Model
Artifact model.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- category
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- clean()[source]
Ensure that data is valid for this artifact category.
- Raises:
ValidationError – for invalid data.
- collection_items
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- created_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- created_by
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 aForwardManyToOneDescriptor
instance.
- created_by_id
- created_by_work_request
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 aForwardManyToOneDescriptor
instance.
- created_by_work_request_id
- data
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- expiration_delay
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property expire_at: datetime.datetime | None
Return computed expiration date.
- expired(at: datetime) bool [source]
Return True if this artifact has expired at a given datetime.
- Parameters:
at – datetime to check if the artifact is expired.
- Return bool:
True if the artifact’s expire_at is on or earlier than the parameter at.
- fileinartifact_set
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- files
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
andTopping.pizzas
areManyToManyDescriptor
instances.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_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)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <debusine.db.models.ArtifactManager object>
- parent_collections
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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- relations
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- targeted_by
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- workspace
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 aForwardManyToOneDescriptor
instance.
- workspace_id
- class debusine.db.models.ArtifactManager(*args, **kwargs)[source]
Bases:
Manager
Manager for the Artifact model.
- classmethod create_from_local_artifact(local_artifact: LocalArtifact[Any], workspace: Workspace, *, created_by_work_request: debusine.db.models.WorkRequest | None = None) Artifact [source]
Return a new Artifact based on a
LocalArtifact
.
- class debusine.db.models.ArtifactRelation(*args, **kwargs)[source]
Bases:
Model
Model relations between artifacts.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- class Relations(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
TextChoices
- BUILT_USING = 'built-using'
- EXTENDS = 'extends'
- RELATES_TO = 'relates-to'
- artifact
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 aForwardManyToOneDescriptor
instance.
- artifact_id
- get_type_display(*, field=<django.db.models.fields.CharField: type>)
- 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>
- target
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 aForwardManyToOneDescriptor
instance.
- target_id
- type
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class debusine.db.models.Collection(*args, **kwargs)[source]
Bases:
Model
Model representing a collection.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- category
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- child_artifacts
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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- child_collections
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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- child_items
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- collection_items
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- data
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- full_history_retention_period
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- item_match_constraints
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- property manager: CollectionManagerInterface
Get collection manager for this collection category.
- metadata_only_retention_period
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name
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>
- parent_collections
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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- workrequest_set
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- workspace
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 aForwardManyToOneDescriptor
instance.
- workspace_id
- class debusine.db.models.CollectionItem(*args, **kwargs)[source]
Bases:
Model
CollectionItem model.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- Types
alias of
_CollectionItemTypes
- active_objects = <debusine.db.models.CollectionItemActiveManager object>
- artifact
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 aForwardManyToOneDescriptor
instance.
- artifact_id
- category
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- child_type
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- collection
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 aForwardManyToOneDescriptor
instance.
- collection_id
- created_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- created_by_user
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 aForwardManyToOneDescriptor
instance.
- created_by_user_id
- data
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- static expand_name(name_template: str, variables: dict[str, str], artifact: Artifact) str [source]
Format item name following item_template.
Expand JSONPath variables against an Artifact data.
- get_child_type_display(*, field=<django.db.models.fields.CharField: child_type>)
- 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)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <debusine.db.models.CollectionItemManager object>
- parent_collection
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 aForwardManyToOneDescriptor
instance.
- parent_collection_id
- removed_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- removed_by_user
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 aForwardManyToOneDescriptor
instance.
- removed_by_user_id
- class debusine.db.models.CollectionItemActiveManager(*args, **kwargs)[source]
Bases:
CollectionItemManager
Manager for active collection items.
- class debusine.db.models.CollectionItemManager(*args, **kwargs)[source]
Bases:
Manager
Manager for CollectionItem model.
- static create_from_artifact(artifact: Artifact, *, parent_collection: Collection, name: str, data: dict[str, Any], created_by_user: User) CollectionItem [source]
Create a CollectionItem from the artifact.
- static create_from_collection(collection: Collection, *, parent_collection: Collection, name: str, data: dict[str, Any], created_by_user: User) CollectionItem [source]
Create a CollectionItem from the collection.
- class debusine.db.models.CollectionItemMatchConstraint(*args, **kwargs)[source]
Bases:
Model
Enforce matching-value constraints on collection items.
All instances of this model with the same
collection
,constraint_name
, andkey
must have the samevalue
.- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- collection
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 aForwardManyToOneDescriptor
instance.
- collection_id
- collection_item_id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- constraint_name
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id
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.
- objects = <django.db.models.manager.Manager object>
- value
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class debusine.db.models.File(*args, **kwargs)[source]
Bases:
Model
Database model of a file.
Model different attributes of the file.
From outside the class use the property
hash
and do not usesha256
field. This allows, if ever needed, to change the hash algorithm only modifying this class without changing the users of this class.- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- artifact_set
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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- current_hash_algorithm = 'sha256'
- fileinartifact_set
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- fileinstore_set
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- filestore_set
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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- classmethod get_or_create(*, hash_digest: bytes, size: int)[source]
Call File.objects.get_or_create with the correct parameters.
- property hash_digest: bytes
Return the default hash digest of the File.
Use this property instead of the field to allow the algorithm to be changed in the future.
- 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>
- sha256
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- size
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class debusine.db.models.FileInArtifact(*args, **kwargs)[source]
Bases:
Model
File in artifact.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- artifact
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 aForwardManyToOneDescriptor
instance.
- artifact_id
- file
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 aForwardManyToOneDescriptor
instance.
- file_id
- fileupload
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 aReverseOneToOneDescriptor
instance.
- 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>
- path
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class debusine.db.models.FileInStore(*args, **kwargs)[source]
Bases:
Model
Database model used as “through” from FileStore.
Keeps the relationship between stores, files and attached data.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- data
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- file
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 aForwardManyToOneDescriptor
instance.
- file_id
- 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>
- store
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 aForwardManyToOneDescriptor
instance.
- store_id
- class debusine.db.models.FileStore(*args, **kwargs)[source]
Bases:
Model
Database model of a FileStore.
FileStore has files attached to it.
- BackendChoices
alias of
_FileStoreBackendChoices
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- backend
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- clean()[source]
Ensure that data is valid for this backend type.
- Raises:
ValidationError – for invalid data.
- configuration
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- configuration_validators = {_FileStoreBackendChoices.EXTERNAL_DEBIAN_SUITE: <class 'debusine.server.file_backend.models.ExternalDebianSuiteBackendConfiguration'>, _FileStoreBackendChoices.LOCAL: <class 'debusine.server.file_backend.models.LocalFileBackendConfiguration'>}
- default_workspaces
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- fileinstore_set
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- files
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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- get_backend_display(*, field=<django.db.models.fields.CharField: backend>)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name
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>
- other_workspaces
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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- class debusine.db.models.FileUpload(*args, **kwargs)[source]
Bases:
Model
File that is being/has been uploaded.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- absolute_file_path() Path [source]
Return the absolute file path of the file.
The files are stored in settings.DEBUSINE_UPLOAD_DIRECTORY.
- classmethod current_size(artifact: Artifact, path_in_artifact: str) int [source]
Return current file size.
The current file size might be smaller than the expected size of the file if the file has not finished being uploaded.
Raise ValueError if path_in_artifact does not exist in Artifact or if there’s no FileUpload object for the specific File.
- file_in_artifact
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 aForwardOneToOneDescriptor
instance.
- file_in_artifact_id
- get_next_by_last_activity_at(*, field=<django.db.models.fields.DateTimeField: last_activity_at>, is_next=True, **kwargs)
- get_previous_by_last_activity_at(*, field=<django.db.models.fields.DateTimeField: last_activity_at>, is_next=False, **kwargs)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- last_activity_at
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>
- path
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class debusine.db.models.Identity(*args, **kwargs)[source]
Bases:
Model
Identity for a user in a remote user database.
An Identity is bound if it’s associated with a Django user, or unbound if no Django user is known for it.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- claims
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_last_used(*, field=<django.db.models.fields.DateTimeField: last_used>, is_next=True, **kwargs)
- get_previous_by_last_used(*, field=<django.db.models.fields.DateTimeField: last_used>, is_next=False, **kwargs)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- issuer
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- last_used
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>
- subject
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- user
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 aForwardManyToOneDescriptor
instance.
- user_id
- class debusine.db.models.NotificationChannel(*args, **kwargs)[source]
Bases:
Model
Model to store notification configuration.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- class Methods(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
TextChoices
- EMAIL = 'email'
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- clean()[source]
Ensure that data is valid for the specific method.
- Raises:
ValidationError – for invalid data.
- data
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- data_validators = {Methods.EMAIL: <class 'debusine.tasks.models.NotificationDataEmail'>}
- get_method_display(*, field=<django.db.models.fields.CharField: method>)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- method
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name
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 debusine.db.models.Token(*args, **kwargs)[source]
Bases:
Model
Database model of a token.
A token contains a key and other related data. It’s used as a shared key between debusine server and clients (workers).
This token model is very similar to rest_framework.authtoken.models.Token. The bigger difference is that debusine’s token’s owner is a CharField, the rest_framework owner is a OneToOne foreign key to a user.
Database-wise we don’t store the token itself, but a hash of the token.
TokenManager.get_token_or_none()
can be used to check a provided token key against the database.- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- comment
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- created_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- enabled
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)
- hash
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <debusine.db.models.TokenManager object>
- user
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 aForwardManyToOneDescriptor
instance.
- user_id
- worker
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 aReverseOneToOneDescriptor
instance.
- class debusine.db.models.TokenManager(*args, **kwargs)[source]
Bases:
Manager
Manager for Token model.
- class debusine.db.models.User(*args, **kwargs)[source]
Bases:
AbstractUser
Debusine user.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- artifact_set
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 aReverseManyToOneDescriptor
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_date_joined(*, field=<django.db.models.fields.DateTimeField: date_joined>, is_next=True, **kwargs)
- get_previous_by_date_joined(*, field=<django.db.models.fields.DateTimeField: date_joined>, is_next=False, **kwargs)
- groups
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
andTopping.pizzas
areManyToManyDescriptor
instances.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.
- identities
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- logentry_set
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- token_set
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- user_created_collectionitem
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- user_permissions
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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- user_removed_collectionitem
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- workrequest_set
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- class debusine.db.models.WorkRequest(*args, **kwargs)[source]
Bases:
Model
Database model of a request to execute a task.
Time-consuming operations offloaded to Workers and using Artifacts (and associated Files) as input and output.
Submission API needs to check if the request is valid using ontological rules - e.g. whether the specified distribution for a build task exists.
Avoid exposing the status of tasks to the admin interface to avoid runaway changes whilst the scheduler process is running.
The WorkRequest uses the non-Django tasks module to do the checks on whether a task can run on a particular worker.
WorkRequest State Machine
New WorkRequest database entries default to
WorkRequest.Statuses.PENDING
.Once the WorkRequest is assigned to a worker and is running starts running the status is changed to
WorkRequest.Statuses.RUNNING
.If the WorkRequest is aborted, the Scheduled.Task status is
WorkRequest.Statuses.ABORTED
.If the task finish on the Worker the WorkRequest status will be
WorkRequest.Statuses.COMPLETED
and a WorkRequest.Result is then set,WorkRequest.Results.PASSED
orWorkRequest.Results.FAILED
.WorkRequest.started_at
is set when the WorkRequest moves fromWorkRequest.Statuses.PENDING
toWorkRequest.Statuses.RUNNING
.WorkRequest.completed_at
is set when the Task moves fromWorkRequest.Statuses.RUNNING
toWorkRequest.Statuses.COMPLETED
.- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- class Results(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
TextChoices
- ERROR = 'error'
- FAILURE = 'failure'
- NONE = ''
- SUCCESS = 'success'
- Statuses
alias of
_WorkRequestStatuses
- class UnblockStrategy(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
TextChoices
- DEPS = 'deps'
- MANUAL = 'manual'
- artifact_set
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- assign_worker(worker: debusine.db.models.Worker | None) None [source]
Assign worker and save it.
- children
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- clean()[source]
Ensure that task data is valid for this task name.
- Raises:
ValidationError – for invalid data.
- completed_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- create_child(task_name: str, status: _WorkRequestStatuses = _WorkRequestStatuses.BLOCKED, task_type: TaskTypes = TaskTypes.WORKER, task_data: dict[str, Any] | None = None, workflow_data: Optional[WorkRequestWorkflowData] = None) WorkRequest [source]
Create a child WorkRequest.
- created_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- created_by
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 aForwardManyToOneDescriptor
instance.
- created_by_id
- dependencies
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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- property event_reactions: EventReactions
Access event_reactions_json as a pydantic structure.
- event_reactions_json
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(*, field=<django.db.models.fields.CharField: result>)
- get_status_display(*, field=<django.db.models.fields.CharField: status>)
- get_task_type_display(*, field=<django.db.models.fields.CharField: task_type>)
- get_triggered_actions() dict[str, list[Union[debusine.tasks.models.ActionSendNotification, debusine.tasks.models.ActionUpdateCollectionWithArtifacts]]] [source]
Filter events to trigger, grouped by type.
- get_unblock_strategy_display(*, field=<django.db.models.fields.CharField: unblock_strategy>)
- get_workflow_root() Optional[WorkRequest] [source]
Return the root of this work request’s workflow, if any.
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- internal_collection
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 aForwardManyToOneDescriptor
instance.
- internal_collection_id
- mark_aborted() bool [source]
Worker has aborted the task after request from UI.
Task will typically be in CREATED or RUNNING status.
- objects = <debusine.db.models.WorkRequestManager object>
- parent
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 aForwardManyToOneDescriptor
instance.
- parent_id
- priority_adjustment
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- priority_base
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- process_update_collection_with_artifacts(actions: list[Union[debusine.tasks.models.ActionSendNotification, debusine.tasks.models.ActionUpdateCollectionWithArtifacts]]) None [source]
Update collection following event_reactions.
- result
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- reverse_dependencies
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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- started_at
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_data
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.
- task_type
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- unblock_strategy
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- 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 aForwardManyToOneDescriptor
instance.
- worker_id
- property workflow_data: Optional[WorkRequestWorkflowData]
Access workflow_data_json as a python structure.
- workflow_data_json
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- workspace
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 aForwardManyToOneDescriptor
instance.
- workspace_id
- class debusine.db.models.WorkRequestManager(*args, **kwargs)[source]
Bases:
Manager
Manager for WorkRequest model.
- create_synchronization_point(*, parent: WorkRequest, status: debusine.db.models._WorkRequestStatuses | None = None)[source]
Create a synchronization point WorkRequest.
A parent is always required, as a synchronization point only makes sense as part of a workflow.
- create_workflow(*, template: WorkflowTemplate, data: dict[str, Any], created_by: User, parent: Optional[WorkRequest] = None, status: debusine.db.models._WorkRequestStatuses | None = None) WorkRequest [source]
Create a workflow from a template and user-provided data.
- create_workflow_callback(*, parent: WorkRequest, step: str, display_name: str | None = None, status: debusine.db.models._WorkRequestStatuses | None = None)[source]
Create a workflow callback WorkRequest.
A parent is always required, as a callback only makes sense as part of a workflow.
- Parameters:
step – string set by the workflow to identify this callback
- pending(exclude_assigned: bool = False, worker: debusine.db.models.Worker | None = None) QuerySet [source]
Return a QuerySet of tasks in WorkRequest.Statuses.PENDING status.
QuerySet is ordered by descending effective priority, then by created_at.
Filter out the assigned pending ones if exclude_assigned=True, and include only the WorkRequest for worker.
PENDING is the default status of a task on creation.
- running(worker: debusine.db.models.Worker | None = None) QuerySet [source]
Return a QuerySet of tasks in running status.
- class debusine.db.models.Worker(*args, **kwargs)[source]
Bases:
Model
Database model of a worker.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- assigned_work_requests
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- concurrency
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- connected_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- dynamic_metadata
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- dynamic_metadata_updated_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_registered_at(*, field=<django.db.models.fields.DateTimeField: registered_at>, is_next=True, **kwargs)
- get_previous_by_registered_at(*, field=<django.db.models.fields.DateTimeField: registered_at>, is_next=False, **kwargs)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- internal
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_busy() bool [source]
Return True if the Worker is busy with work requests.
A Worker is busy if it has as many running or pending work requests as its concurrency level.
- metadata() dict[str, Any] [source]
Return all metadata with static_metadata and dynamic_metadata merged.
If the same key is in static_metadata and dynamic_metadata: static_metadata takes priority.
- name
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <debusine.db.models.WorkerManager object>
- registered_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- set_dynamic_metadata(metadata: dict[str, Any]) None [source]
Save metadata and update dynamic_metadata_updated_at.
- static_metadata
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- token
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 aForwardOneToOneDescriptor
instance.
- token_id
- class debusine.db.models.WorkerManager(*args, **kwargs)[source]
Bases:
Manager
Manager for Worker model.
- classmethod create_with_fqdn(fqdn: str, token: Token) Worker [source]
Return a new Worker with its name based on fqdn, with token.
- classmethod get_or_create_celery() Worker [source]
Return a new Worker representing the Celery task queue.
- get_worker_by_token_key_or_none(token_key: str) Optional[Worker] [source]
Return a Worker identified by its associated secret token.
- get_worker_or_none(worker_name: str) Optional[Worker] [source]
Return the worker with worker_name or None.
- waiting_for_work_request() QuerySet [source]
Return workers that can be assigned a new work request.
The workers with fewer associated pending or running work requests than their concurrency level could take more work right now and are thus waiting for a work request.
Worker’s token must be enabled.
- class debusine.db.models.WorkflowTemplate(*args, **kwargs)[source]
Bases:
Model
Database model for Workflow templates.
Workflow templates contain the information needed to instantiate a workflow, with a Workflow orchestrator and mandatory parameters.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- clean()[source]
Ensure that task_name and task data are valid.
- Raises:
ValidationError – for invalid data.
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name
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>
- priority
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- task_data
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.
- workspace
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 aForwardManyToOneDescriptor
instance.
- workspace_id
- class debusine.db.models.Workspace(*args, **kwargs)[source]
Bases:
Model
Workspace model.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- artifact_set
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- collection_set
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- default_expiration_delay
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- default_file_store
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 aForwardManyToOneDescriptor
instance.
- default_file_store_id
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_file_in_workspace(fileobj: File) bool [source]
Return True if fileobj is in any store available for Workspace.
- name
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <debusine.db.models.WorkspaceManager object>
- other_file_stores
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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- public
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- workflowtemplate_set
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- workrequest_set
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.