Repository Apply Model
A batch apply of a GitHub repository’s manifests, which a user starts from the web console’s Apply page.
The Celery task smarter.apps.account.tasks.apply_repository() clones the repository, records each
manifest that it finds as a RepositoryApplyManifest, pending, then applies them one by one, as
manage.py load_from_github does, and records each one’s result: applied, skipped or failed, with why.
The web console polls the run, and shows each manifest’s state. See smarter.apps.account.repository_apply.
- smarter.apps.account.models.repository_apply.REPOSITORY_APPLY_STALE_AFTER = datetime.timedelta(seconds=1800)
A run that has neither finished nor failed after this long is abandoned, e.g. its worker restarted.
The user may then start another.
- class smarter.apps.account.models.repository_apply.RepositoryApply(*args, **kwargs)[source]
Bases:
TimestampedModelA batch apply of a GitHub repository’s manifests.
- Parameters:
user_profile – The user who started it, as whom every manifest is applied, in their account.
url – The repository, e.g.
https://github.com/smarter-sh/example-manifests.commit – The commit that was cloned, or an empty string before then, or if git couldn’t tell.
status – One of
RepositoryApplyStatus.error – Why the run failed as a whole, e.g. the repository couldn’t be cloned. A manifest’s own failure is its
RepositoryApplyManifest.message.completed_at – When it finished or failed.
id (Unknown) – Primary key: ID
created_at (Unknown) – Created at
updated_at (Unknown) – Updated at
Reverse relationships:
- Parameters:
manifests (Unknown) – All manifests of this Repository Apply (related name of
repository_apply)
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- exception NotUpdated
Bases:
ObjectNotUpdated,DatabaseError
- completed_at
-
Completed at
- Type:
Type
- created_at
-
Created at
Timestamp indicating when the model instance was created.
This field is automatically set to the current date and time when the instance is first created. It is indexed in the database for efficient querying.
- Type:
Type
- get_status_display(*, field=<django.db.models.CharField: status>)
Shows the label of the
status. Seeget_FOO_display()for more information.
- id: int
-
Primary key: ID
The row’s primary key, which Django adds to every concrete model. Declared, without a value, only so that type checkers know it: Django ignores a bare annotation.
- Type:
Type
- property is_stale: bool
unfinished for longer than
REPOSITORY_APPLY_STALE_AFTER.- Type:
Whether it was abandoned
- manifests
Reverse
ForeignKeyfromRepositoryApplyManifestAll manifests of this Repository Apply (related name of
repository_apply)- Type:
Type
- objects = <django.db.models.Manager object>
- updated_at
-
Updated at
Timestamp indicating when the model instance was last updated.
This field is automatically updated to the current date and time whenever the instance is saved. It is indexed in the database for efficient querying.
- Type:
Type
- user_profile
-
User profile (related name:
repository_applies)- Type:
Type
- user_profile_id
Internal field, use
user_profileinstead.
- class smarter.apps.account.models.repository_apply.RepositoryApplyManifest(*args, **kwargs)[source]
Bases:
TimestampedModelOne manifest of a batch apply, in the order in which it is applied.
- Parameters:
repository_apply – The run.
position – Its place in the order of application, from 0.
path – Its file, relative to the repository’s root, e.g.
plugins/sql/stackademy-sql.yaml.kind – Its kind, e.g.
SqlPlugin.name – Its
metadata.name.status – One of
RepositoryApplyManifestStatus.message – Why it failed or was skipped, or an empty string.
output – What applying it printed, for a user who investigates a failure.
id (Unknown) – Primary key: ID
created_at (Unknown) – Created at
updated_at (Unknown) – Updated at
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- exception NotUpdated
Bases:
ObjectNotUpdated,DatabaseError
- created_at
-
Created at
Timestamp indicating when the model instance was created.
This field is automatically set to the current date and time when the instance is first created. It is indexed in the database for efficient querying.
- Type:
Type
- get_status_display(*, field=<django.db.models.CharField: status>)
Shows the label of the
status. Seeget_FOO_display()for more information.
- id: int
-
Primary key: ID
The row’s primary key, which Django adds to every concrete model. Declared, without a value, only so that type checkers know it: Django ignores a bare annotation.
- Type:
Type
- objects = <django.db.models.Manager object>
- position
-
Position
- Type:
Type
- repository_apply_id
Internal field, use
repository_applyinstead.
- updated_at
-
Updated at
Timestamp indicating when the model instance was last updated.
This field is automatically updated to the current date and time whenever the instance is saved. It is indexed in the database for efficient querying.
- Type:
Type