core.models.Daemon module¶
Module with the Daemon model class.
- core.models.Daemon.logger = <Logger core.models.Daemon (INFO)>¶
The logger instance for this module.
- class core.models.Daemon.Daemon(*args, **kwargs)[source]¶
Bases:
ExportModelOperationsMixin('routine'),DirtyFieldsMixin,URLMixin,HealthModelMixin,TimestampModelMixin,ModelDatabase model for the daemon fetching a mailbox.
Note
The internal name of this object is
daemon, the external name for the user interface isroutine.- BASENAME = 'daemon'¶
- DELETE_NOTICE = 'This will only delete this routine, not its mailbox.'¶
- DELETE_NOTICE_PLURAL = 'This will only delete these routine, not their mailboxes.'¶
- uuid¶
The uuid of this daemon. Used to create a unique logfile.
- mailbox: ForeignKey¶
The mailbox this daemon fetches. Unique. Deletion of that
mailboxdeletes this daemon.
- fetching_criterion¶
The fetching criterion for this mailbox.
eonvelope.constants.EmailFetchingCriterionChoices.ALLby default.
- fetching_criterion_arg¶
Additional fetching criterion argument for this mailbox. “” by default.
- celery_task: OneToOneField¶
The periodic celery task wrapped by this daemon.
- interval: ForeignKey¶
The period with which the daemon is running.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- _meta = <Options for Daemon>¶
- celery_task_id¶
- created¶
The datetime the model instance was created. Is set automatically.
- get_fetching_criterion_display(*, field=<django.db.models.fields.CharField: fetching_criterion>)¶
- get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)¶
- get_next_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=True, **kwargs)¶
- get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)¶
- get_previous_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, 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.
- interval_id¶
- is_healthy¶
Flags whether the model instance is subject to errors. None by default.
- last_error¶
The latest error in connection with the model instance.
- last_error_occurred_at¶
The time of occurrence of the latest error.
- mailbox_id¶
- objects = <django.db.models.manager.Manager object>¶
- updated¶
The datetime the model instance entry was last updated. Is set automatically.
- clean()[source]¶
Validates that
fetching_criterionis available for themailbox.account.- Return type:
- test()[source]¶
Tests whether the data in the model is correct and the daemons task can be run.
Tests the entire task, including fetching and the celery backend. The
core.models.Daemon.is_healthyflag is set accordingly by the task itself.
- start()[source]¶
Start the daemons
celery_task.- Return type:
- Returns:
Whether the start operation was successful.
- stop()[source]¶
Stops the daemons
celery_task.- Return type:
- Returns:
Whether the stop operation was successful.