
    {kf!                        d Z ddlmZ ddlmZ ddlZddlmZ ddlm	Z	m
Z
mZmZ ddlmZ ddlmZ dd	lmZ dd
lmZ d-dZd Zd Zed         ZdededdfdZdefdZdedefdZ ej        e
           ej        ddee ddd           ej        ddee	dd            ej        d!d"ed#dd$%          ej!        ed&                                                                         Z" ej        e
d'd#i(           ej#        d           ed)           ej        ddee ddd           ej        ddee	dd            ej        d!d"ed#dd$%          ej!        ed*                                                                                                 Z$ ej        e
d'd#i(           ej#        d           ed+           ej        ddee ddd           ej        ddee	dd            ej        d!d"ed#dd$%          ej!        ed,                                                                                                 Z%dS ).z@The ``celery control``, ``. inspect`` and ``. status`` programs.    )partial)LiteralN)dumps)COMMA_SEPARATED_LISTCeleryCommandCeleryOptionhandle_preload_options)CeleryCommandException)EX_UNAVAILABLE)text)PanelFc                 :   t          t          |                    }||         }| j                            | ddd          }| j                            |          \  }}| j                            d| | |rt          j        |d          nd|           d S )	Nz: cyanT)fgboldz->    )	show_body)nextiterobjstyleprettysay_chatr   indent)ctxreplies
show_replynodereplystatuspreplys          R/var/www/html/nettyfy-visnx/env/lib/python3.11/site-packages/celery/bin/control.py_say_remote_command_replyr$      s    WDDME7==Dd=;;DW^^E**NFFGTd,F,,/9AT[+++r)  + + + + +    c              #   R  K   d}	 t          |          D ]n\  }}	 | j        |         \  }}|| ||          n|fV  *# t          $ r8 | j        rY  n1t	          j        d                    || j                            w xY w||d          |d d <   d S # ||d          |d d <   w xY w)Nr   z Command {!r} takes arguments: {})	enumerateargs
IndexErrorvariadicclick
UsageErrorformat	signature)metamethodr(   iargnametyps          r#   _consume_argumentsr5      s      	Aoo 
	A 
	AFAs	A IaL	c CCHHHS@@@@@  1 1 1= EE&6==0 01 1 11 qrr(QQQ$qrr(QQQs+   B ?B BB .BB B&c                     t           j        |          }i }|j        r.|                    d t	          || |          D                        |j        r|                    |j        |i           |S )Nc                     i | ]\  }}||	S  r8   ).0kvs      r#   
<dictcomp>z&_compile_arguments.<locals>.<dictcomp>/   s+     
 
 
QAq
 
 
r%   )r   r/   r(   updater5   r*   )commandr(   r/   	argumentss       r#   _compile_argumentsr@   +   s    :gDIy  
 
/gtDD
 
 
 	 	 	 } 0$-.///r%   )inspectcontroltype_r>   returnc                     t          |           }||vr3d                    |          }t          j        d| d|  d|           d S )Nz, zCommand z not recognized. Available z commands: )message)_get_commands_of_typejoinr+   r,   )rC   r>   choicescommand_listings       r#   _verify_command_namerK   :   si    #E**Gg))G,,fwff5ffUdff
 
 
 	
 r%   c                 h     dt           j        dd f fd}t          j        ddd  ddd|	          S )
Nr   rD   c                 "   |sd S t          	          }t          j                    }|                    	                                 d          5  g }|                                D ]7\  }}|j        r| d|j         }n|}|                    ||j        f           8|	                    |           d d d            n# 1 swxY w Y   | j
                            |                                d           |                                  d S )Nz	 Commands F)nl)rG   r+   HelpFormattersection
capitalizeitemsr.   appendhelpwrite_dlr   echogetvalueexit)
r   paramvaluerI   	formattercommand_listcommand_nameinfocommand_previewrC   s
            r#   callbackz_list_option.<locals>.callbackE   s[    	F'..'))	%"2"2"4"4???@@ 	- 	-L&-mmoo B B"d> 3)5&H&H&H&HOO&2O##_di$@AAAA|,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	Y''))e444




s   A$CC	Cz--listTzList available z commands and exit.F)is_flagrU   expose_valueis_eagerra   )r+   Contextoption)rC   ra   s   ` r#   _list_optionrg   D   si    em d      & <9u999   r%   c                       fdt           j                                        D             }t          t	          |                    S )Nc                 B    g | ]\  }}|j         k    |j        ||fS r8   )typevisible)r9   r3   r_   rC   s      r#   
<listcomp>z)_get_commands_of_type.<locals>.<listcomp>c   s?       #t9$, 
tr%   )r   r/   rS   dictsorted)rC   command_name_info_pairss   ` r#   rG   rG   b   sS       ',z'7'7'9'9   .//000r%   )clsz-tz	--timeoutg      ?zRemote Control Optionsz%Timeout in seconds waiting for reply.)rp   rj   default
help_grouprU   z-dz--destinationz/Comma separated list of destination node names.)rp   rj   rr   rU   z-jz--jsonTzUse json as output format.)rp   rb   rr   rU   c           	         |rdnt          t          |           }| j        j        j                            |||                                          }|st          dt                    |r'| j        	                    t          |                     t          |          }|                    dd          sC| j        	                    d                    |t          j        |d                               dS dS )	z%Show list of workers that are online.Ntimeoutdestinationra   'No nodes replied within time constraintrF   	exit_codequietF
{} {} online.r   )r   r$   r   apprB   rA   pingr
   r   rW   r   lengetr-   r   	pluralize)r   ru   rv   jsonkwargsra   r   	nodecounts           r#   r!   r!   j   s   0 Htt)BC!H!HHgk!))'6A3; * = ==ATVV   
$=$
 
 
 	

  %U7^^$$$GI::gu%% ;&--t~i88: : 	; 	; 	; 	; 	;; ;r%   allow_extra_args)rp   context_settingsrA   c           	      2   t          d|           |rdnt          t          | d          }t          || j                  }| j        j        j                            |||          } |j	        |fi |}	|	st          dt                    |r)| j                            t          |	                     dS t          |	          }
| j        j        sC| j                            d                    |
t#          j        |
d	                               dS dS )
z~Inspect the workers by sending them the COMMAND inspect command.

    Availability: RabbitMQ (AMQP) and Redis transports.
    rA   NTr   rt   rw   rx   r{   r   )rK   r   r$   r@   r(   r   r|   rB   rA   _requestr
   r   rW   r   r~   rz   r-   r   r   )r   r>   ru   rv   r   r   ra   r?   rA   r   r   s              r#   rA   rA      sF   < G,,, :tt)BC48": ": ":H"7CH55Igk!))'6A3; * = =G gw44)44G 
$=$
 
 
 	

  U7^^$$$GI7= ;&--t~i88: : 	; 	; 	; 	; 	;; ;r%   rB   c                 d   t          d|           |rdnt          t          | d          }| j        }t	          ||          }| j        j        j                            ||||d|          }|st          dt                    |r)| j                            t          |                     dS dS )zxSend the COMMAND control command to the workers.

    Availability: RabbitMQ (AMQP), Redis, and MongoDB transports.
    rB   NTr   )ru   rv   ra   r    r?   rw   rx   )rK   r   r$   r(   r@   r   r|   rB   	broadcastr
   r   rW   r   )	r   r>   ru   rv   r   ra   r(   r?   r   s	            r#   rB   rB      s    < G,,, :tt)BC48": ": ":H8D"7D11Igk!++GW8C5=266?	 , A AG  
$=$
 
 
 	

  %U7^^$$$$$% %r%   )F)&__doc__	functoolsr   typingr   r+   kombu.utils.jsonr   celery.bin.baser   r   r   r	   celery.exceptionsr
   celery.platformsr   celery.utilsr   celery.worker.controlr   r$   r5   r@   _RemoteControlTypestrrK   rg   rm   rG   r>   rf   floatpass_contextr!   argumentrA   rB   r8   r%   r#   <module>r      s   F F              " " " " " " e e e e e e e e e e e e 4 4 4 4 4 4 + + + + + +       ' ' ' ' ' '+ + + +  $	 	 	 12 
 2 
S 
T 
 
 
 
*    <1!3 1 1 1 1 1 =!!!d1:< < < d'1DF F F d1/1 1 1 ; ;  1 1F F< < "!,;* =!3T :< < <	id1:< < < d'1DF F F d1/1 1 1 ; ;  1 1F F< <  < <2;< =!3T :< < <	id1:< < < d'1DF F F d1/1 1 1 % %  1 1F F< <  < <2% % %r%   