
    jg                     $   d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ d	d
lmZ  eej$                        Z e eee            Z G d dej*                        Z G d dej*                        Z G d dej*                        Zy)zDatabase models.    N)states)GroupResult)result_from_tuple)settings)models)gettext_lazy   )managersc            	       :   e Zd ZdZ ej
                   eedd      d ed       ed            Z	 ej
                  dd ed       ed	      
      Z
 ej
                  d eedd       ed       ed      
      Z ej                  d ed       ed            Z ej                  d ed       ed            Z ej
                  dej                   e ed       ed            Z ej
                  ddd ed       ed            Z ej
                  d ed       ed            Z ej
                  d ed        ed!            Z ej                  ddd" ed#       ed$      %      Z ej.                  d ed&       ed'      (      Z ej.                  d ed)       ed*      +      Z ej                  dd ed,       ed-      .      Z ej                  ddd" ed/       ed0      %      Z ej:                         Z G d1 d2      Zd3 Z d4 Z!y)5
TaskResultzTask result/status.(DJANGO_CELERY_RESULTS_TASK_ID_MAX_LENGTH   TzTask IDz#Celery ID for the Task that was run
max_lengthuniqueverbose_name	help_textzPeriodic Task Namez'Name of the Periodic Task which was run)nullr   r   r   z	Task NamezName of the Task which was runzTask Positional ArgumentszBJSON representation of the positional arguments used with the task)r   r   r   zTask Named Argumentsz=JSON representation of the named arguments used with the task2   z
Task Statez#Current state of the task being run)r   defaultchoicesr   r   d   NWorkerzWorker that executes the task)r   r   r   r   r      Result Content TypeContent type of the result datar   r   r   @   Result Encoding.The encoding used to save the task result dataFResult DataUThe data returned by the task.  Use content_encoding and content_type fields to read.r   r   editabler   r   Created DateTimez6Datetime field when the task result was created in UTCauto_now_addr   r   Completed DateTimez1Datetime field when the task was completed in UTCauto_nowr   r   	Tracebackz/Text of the traceback if the task generated one)blankr   r   r   zTask Meta InformationzHJSON meta information about the task, such as information on child tasksc                      e Zd ZdZdgZ ed      Z ed      Z ej                  dgd       ej                  dgd	       ej                  d
gd       ej                  dgd       ej                  dgd      gZ
y)TaskResult.MetaTable information.
-date_doneztask resultztask results	task_namedjango_cele_task_na_08aec9_idxfieldsnamestatusdjango_cele_status_9b6201_idxworkerdjango_cele_worker_d54dd8_idxdate_createddjango_cele_date_cr_f04a50_idx	date_donedjango_cele_date_do_f59aad_idxN__name__
__module____qualname____doc__ordering_r   verbose_name_pluralr   Indexindexes     W/var/www/html/Stanley/venv/lib/python3.12/site-packages/django_celery_results/models.pyMetar.   ^   s      >'/ FLL>@FLL
=?FLL
=?FLL 0>@FLL>@
rI   rK   c                     | j                   | j                  | j                  | j                  | j                  | j
                  | j                  | j                  | j                  | j                  d
S )N
task_idr1   	task_argstask_kwargsr6   resultr<   	tracebackmetar8   rM   selfs    rJ   as_dictzTaskResult.as_dictt   sT    ||++kkkkIIkk
 	
rI   c                 $    dj                  |       S )Nz <Task: {0.task_id} ({0.status})>)formatrT   s    rJ   __str__zTaskResult.__str__   s    188>>rI   )"r?   r@   rA   rB   r   	CharFieldgetattrr   rD   rN   periodic_task_namer1   	TextFieldrO   rP   r   PENDINGTASK_STATE_CHOICESr6   r8   content_typecontent_encodingrQ   DateTimeFieldr:   r<   rR   rS   r
   TaskResultManagerobjectsrK   rV   rY   rH   rI   rJ   r   r      s   f6

 y\9:<G *))c+,=>@ !  g6

 {^457I !  23 ) *+I
 #&""-. ) *+K
 Vv~~"|_9:	<F
 V4x[A.M,NF $6##,-568L (v''()DEG V4%}% L MNF
 (6'')*LMOL %$$+,GHJI !  {^EFHI 64%./ 9 :;D )h((*G
 
,
?rI   r   c                       e Zd ZdZ ej
                   eedd      d ed       ed            Z	 ej                   ed      	      Z ej                   ed
      	      ZddZy)ChordCounterzChord synchronisation.r   r   TGroup IDz$Celery ID for the Chord header groupr   zIJSON serialized list of task result tuples. use .group_result() to decode)r   zFStarts at len(chord header) and decrements after each task is finishedNc           
          t        | j                  t        j                  | j                        D cg c]  }t        ||       c}|      S c c}w )zReturn the :class:`celery.result.GroupResult` of self.

        Arguments:
            app (celery.app.base.Celery): app instance to create the
               :class:`celery.result.GroupResult` with.

        )app)CeleryGroupResultgroup_idjsonloads	sub_tasksr   )rU   ri   rs      rJ   group_resultzChordCounter.group_result   sO     !MMjj020 qc*02	
 	
2s   A
)N)r?   r@   rA   rB   r   rZ   r[   r   rD   rk   r]   rn   PositiveIntegerFieldcountrp   rH   rI   rJ   rf   rf      s     v6 z]:;H !  ,
I (F''
E
rI   rf   c            	          e Zd ZdZ ej
                   eedd      d ed       ed            Z	 ej                  d ed       ed	      
      Z ej                  d ed       ed            Z ej
                  d ed       ed            Z ej
                  d ed       ed            Z ej                  ddd ed       ed            Zd Zd Z ej(                         Z G d d      Zy)r   zTask Group result/status.r   r   Trg   z$Celery ID for the Group that was runr   r%   z7Datetime field when the group result was created in UTCr&   r(   z2Datetime field when the group was completed in UTCr)   r   r   r   r   r   r   r    NFr!   r"   r#   c                 J    | j                   | j                  | j                  dS )Nrk   rQ   r<   ru   rT   s    rJ   rV   zGroupResult.as_dict   s!    kk
 	
rI   c                 "    d| j                    dS )Nz<Group: >)rk   rT   s    rJ   rY   zGroupResult.__str__   s    $--**rI   c                       e Zd ZdZdgZ ed      Z ed      Z ej                  dgd       ej                  dgd	      gZ
y
)GroupResult.Metar/   r0   zgroup resultzgroup resultsr:   django_cele_date_cr_bd6c1d_idxr3   r<   django_cele_date_do_caae0e_idxNr>   rH   rI   rJ   rK   ry      sW      >(0 FLL 0>@FLL>@
rI   rK   )r?   r@   rA   rB   r   rZ   r[   r   rD   rk   rb   r:   r<   r`   ra   r]   rQ   rV   rY   r
   GroupResultManagerrd   rK   rH   rI   rJ   r   r      s;   #v6

 z]:;	H (6'')*MNL
 %$$+,HII
 $6##,-56L
 (v''()DE
 V4%}% L MNF
+ *h))+G
 
rI   r   )rB   rl   celeryr   celery.resultr   rj   r   django.confr   	django.dbr   django.utils.translationr   rD    r
   sorted
ALL_STATESzipr_   Modelr   rf   rH   rI   rJ   <module>r      sx       : +    6 F%%&
C
J78 q? q?h&
6<< &
RA
&,, A
rI   