1- from uuid import uuid4
21from types import SimpleNamespace
2+ from uuid import uuid4
33
44from django .db import models
5- from django .utils .translation import gettext_lazy as _
65from django .utils .timezone import now
6+ from django .utils .translation import gettext_lazy as _
77
88# NOTE: tasks are not registered in the database, but in a dispatcher registry
99
@@ -23,32 +23,21 @@ class Task(models.Model):
2323 Corresponds to a call of a task, as a higher-level abstraction around the dispatcher.
2424 Loosely modeled after pulpcore.Task
2525 """
26- uuid = models .UUIDField (
27- primary_key = True , default = uuid4 , editable = False ,
28- help_text = _ ('UUID that corresponds to the dispatcher task uuid' )
29- )
26+
27+ uuid = models .UUIDField (primary_key = True , default = uuid4 , editable = False , help_text = _ ('UUID that corresponds to the dispatcher task uuid' ))
3028 state = models .CharField (
3129 choices = [(s , s .title ()) for s in sorted (vars (TASK_STATES ).values ())],
3230 default = TASK_STATES .WAITING ,
33- help_text = _ ('Choices of this field track with acknowledgement and completion of a task' )
34- )
35- name = models .TextField (
36- help_text = _ ('Importable path for class or method' )
31+ help_text = _ ('Choices of this field track with acknowledgement and completion of a task' ),
3732 )
33+ name = models .TextField (help_text = _ ('Importable path for class or method' ))
3834
3935 created = models .DateTimeField (
40- auto_now_add = True ,
41- help_text = _ ('Time the publisher (submitter) of this task call created it, approximately the time of submission as well' )
36+ auto_now_add = True , help_text = _ ('Time the publisher (submitter) of this task call created it, approximately the time of submission as well' )
4237 )
4338 # pulp has unblocking logic, like unblocked_at, we have no plans for that here
44- started_at = models .DateTimeField (
45- null = True ,
46- help_text = _ ('Time of acknowledgement, also approximately the time the task starts' )
47- )
48- finished_at = models .DateTimeField (
49- null = True ,
50- help_text = _ ('Time task is cleared (whether failed or succeeded), may be unused if set to auto-delete' )
51- )
39+ started_at = models .DateTimeField (null = True , help_text = _ ('Time of acknowledgement, also approximately the time the task starts' ))
40+ finished_at = models .DateTimeField (null = True , help_text = _ ('Time task is cleared (whether failed or succeeded), may be unused if set to auto-delete' ))
5241
5342 def mark_ack (self ):
5443 self .state = TASK_STATES .RUNNING
0 commit comments