HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //usr/local/lib/python3.9/site-packages/celery/__pycache__/beat.cpython-39.pyc
a

X>h�_�@s dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
ddlmZddlmZmZddlmZddlmZdd	lmZdd
lmZmZddlmZdd
lmZm Z m!Z!ddl"m#Z#ddl$m%Z%m&Z&ddl'm(Z(ddl)m*Z*m+Z+ddl,m-Z-m.Z.ddl/m0Z0m1Z1dZ2e
dd�Z3e-e4�Z5e5j6e5j7e5j8e5j9f\Z6Z7Z8Z9dZ:Gdd�de;�Z<Gdd�d�Z=eGdd�d��Z>dd�Z?d d!�Z@Gd"d#�d#�ZAGd$d%�d%eA�ZBGd&d'�d'�ZCGd(d)�d)e�ZDz
e�WneE�ydZFYn0Gd*d+�d+e�ZFd.d,d-�ZGdS)/zThe periodic task scheduler.�N)�timegm)�
namedtuple)�total_ordering)�Event�Thread)�ensure_multiprocessing)�
reset_signals)�Process)�maybe_evaluate�reprcall)�cached_property�)�__version__�	platforms�signals)�reraise)�crontab�maybe_schedule)�is_numeric_value)�load_extension_class_names�symbol_by_name)�
get_logger�iter_open_logger_fds)�humanize_seconds�maybe_make_aware)�SchedulingError�
ScheduleEntry�	Scheduler�PersistentScheduler�Service�EmbeddedService�event_t)�time�priority�entryi,c@seZdZdZdS)rz*An error occurred while scheduling a task.N)�__name__�
__module__�__qualname__�__doc__�r)r)�5/usr/local/lib/python3.9/site-packages/celery/beat.pyr-src@s(eZdZdZdd�Zdd�Zdd�ZdS)	�BeatLazyFuncaoA lazy function declared in 'beat_schedule' and called before sending to worker.

    Example:

        beat_schedule = {
            'test-every-5-minutes': {
                'task': 'test',
                'schedule': 300,
                'kwargs': {
                    "current": BeatCallBack(datetime.datetime.now)
                }
            }
        }

    cOs||_||d�|_dS)N)�args�kwargs�Z_funcZ_func_params)�self�funcr,r-r)r)r*�__init__Bs�zBeatLazyFunc.__init__cCs|��S�N)�delay�r/r)r)r*�__call__IszBeatLazyFunc.__call__cCs|j|jdi|jd��S)Nr,r-r.r4r)r)r*r3LszBeatLazyFunc.delayN)r%r&r'r(r1r5r3r)r)r)r*r+1sr+c
@s�eZdZdZdZdZdZdZdZdZ	dZ
ddd�Zdd	�ZeZ
dd
d�ZeZZdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdS)ra�An entry in the scheduler.

    Arguments:
        name (str): see :attr:`name`.
        schedule (~celery.schedules.schedule): see :attr:`schedule`.
        args (Tuple): see :attr:`args`.
        kwargs (Dict): see :attr:`kwargs`.
        options (Dict): see :attr:`options`.
        last_run_at (~datetime.datetime): see :attr:`last_run_at`.
        total_run_count (int): see :attr:`total_run_count`.
        relative (bool): Is the time relative to when the server starts?
    Nrr)FcCsb|
|_||_||_||_|r |ni|_|r.|ni|_t||	|jd�|_|pP|��|_	|pZd|_
dS)N)�appr)r6�name�taskr,r-�optionsr�schedule�default_now�last_run_at�total_run_count)r/r7r8r<r=r:r,r-r9�relativer6r)r)r*r1tszScheduleEntry.__init__cCs|jr|j��S|j��Sr2)r:�nowr6r4r)r)r*r;�szScheduleEntry.default_nowcCs(|jfit||p|��|jdd���S)z8Return new instance, with date and count fields updated.r
)r<r=)�	__class__�dictr;r=)r/r<r)r)r*�_next_instance�s


�zScheduleEntry._next_instancec	Cs*|j|j|j|j|j|j|j|j|jffSr2)	r@r7r8r<r=r:r,r-r9r4r)r)r*�
__reduce__�s�zScheduleEntry.__reduce__cCs&|j�|j|j|j|j|jd��dS)z�Update values from another entry.

        Will only update "editable" fields:
            ``task``, ``schedule``, ``args``, ``kwargs``, ``options``.
        )r8r:r,r-r9N)�__dict__�updater8r:r,r-r9�r/�otherr)r)r*rE�s
�zScheduleEntry.updatecCs|j�|j�S)z.See :meth:`~celery.schedules.schedule.is_due`.)r:�is_duer<r4r)r)r*rH�szScheduleEntry.is_duecCstt|����Sr2)�iter�vars�itemsr4r)r)r*�__iter__�szScheduleEntry.__iter__cCs,dj|t|j|jpd|jpi�t|�jd�S)Nz%<{name}: {0.name} {call} {0.schedule}r))�callr7)�formatrr8r,r-�typer%r4r)r)r*�__repr__�s
�zScheduleEntry.__repr__cCst|t�rt|�t|�kStSr2)�
isinstancer�id�NotImplementedrFr)r)r*�__lt__�s
zScheduleEntry.__lt__cCs(dD]}t||�t||�krdSqdS)N)r8r,r-r9r:FT)�getattr)r/rG�attrr)r)r*�editable_fields_equal�sz#ScheduleEntry.editable_fields_equalcCs
|�|�S)z�Test schedule entries equality.

        Will only compare "editable" fields:
        ``task``, ``schedule``, ``args``, ``kwargs``, ``options``.
        )rWrFr)r)r*�__eq__�szScheduleEntry.__eq__)
NNNNNr)NNFN)N)r%r&r'r(r7r:r,r-r9r<r=r1r;Z_default_nowrB�__next__�nextrCrErHrLrPrTrWrXr)r)r)r*rPs0�


rcCs|sgSdd�|D�S)NcSs g|]}t|t�r|�n|�qSr)�rQr+)�.0�vr)r)r*�
<listcomp>�s�z(_evaluate_entry_args.<locals>.<listcomp>r))�
entry_argsr)r)r*�_evaluate_entry_args�s
�r`cCs|siSdd�|��D�S)NcSs&i|]\}}|t|t�r|�n|�qSr)r[)r\�kr]r)r)r*�
<dictcomp>�s�z*_evaluate_entry_kwargs.<locals>.<dictcomp>)rK)�entry_kwargsr)r)r*�_evaluate_entry_kwargs�s
�rdc@s@eZdZdZeZdZeZdZ	dZ
dZdZe
Z
d>dd�Zdd	�Zd?d
d�Zd@d
d�Zdd�Zefdd�Zeejfdd�Zeeejejfdd�Zdd�Zdd�Zdd�ZdAdd�Z d d!�Z!d"d#�Z"d$d%�Z#d&d'�Z$d(d)�Z%d*d+�Z&d,d-�Z'd.d/�Z(d0d1�Z)d2d3�Z*d4d5�Z+d6d7�Z,e-e+e,�Ze.d8d9��Z/e.d:d;��Z0e-d<d=��Z1dS)Bra�Scheduler for periodic tasks.

    The :program:`celery beat` program may instantiate this class
    multiple times for introspection purposes, but then with the
    ``lazy`` argument set.  It's important for subclasses to
    be idempotent when this argument is set.

    Arguments:
        schedule (~celery.schedules.schedule): see :attr:`schedule`.
        max_interval (int): see :attr:`max_interval`.
        lazy (bool): Don't set up the schedule.
    N�rFcKsp||_t|durin|�|_|p,|jjp,|j|_|p:|jj|_d|_d|_	|durZ|jj
n||_|sl|��dSr2)
r6r
�data�conf�beat_max_loop_interval�max_intervalZamqp�Producer�_heap�old_schedulersZbeat_sync_every�sync_every_tasks�setup_schedule)r/r6r:rirj�lazyrmr-r)r)r*r1�s���zScheduler.__init__cCsJi}|jjjr<|jjjs<d|vr<dtddd�ddid�|d<|�|�dS)Nzcelery.backend_cleanup�0�4�*�expiresi��)r8r:r9)r6rgZresult_expires�backendZsupports_autoexpirer�update_from_dict)r/rf�entriesr)r)r*�install_default_entriess
�
�
z!Scheduler.install_default_entriesc
Cs�td|j|j�z|j||dd�}Wn8ty\}z td|t��dd�WYd}~n6d}~00|r~t|d�r~t	d|j|j
�nt	d	|j�dS)
Nz#Scheduler: Sending due task %s (%s)F)�producer�advancezMessage Error: %s
%sT��exc_inforRz%s sent. id->%sz%s sent.)�infor7r8�apply_async�	Exception�error�	traceback�format_stack�hasattr�debugrR)r/r$rx�result�excr)r)r*�apply_entrys
�zScheduler.apply_entry�{�G�z��cCs|r|dkr||S|S)Nrr))r/�nZdriftr)r)r*�adjust#szScheduler.adjustcCs|��Sr2)rH)r/r$r)r)r*rH(szScheduler.is_duecCs4|j}t|���}||���|jd||�p0dS)z9Return a utc timestamp, make sure heapq in correct order.g��.Ar)r�rr;�utctimetuple�microsecond)r/r$�next_time_to_run�mktimer�Zas_nowr)r)r*�_when+s
�
�zScheduler._whencCs\d}g|_|j��D]8}|��\}}|j�||�||r:dn|�pBd||��q||j�dS)z:Populate the heap with the data contained in the schedule.�rN)rkr:�valuesrH�appendr�)r/r!�heapifyr#r$rHZnext_call_delayr)r)r*�
populate_heap5s
��zScheduler.populate_heapcCs�|j}|j}|jdus&|�|j|j�s<t�|j�|_|��|j}|sJ|S|d}|d}	|�|	�\}
}|
r�||�}||ur�|�	|	�}
|j
|	|jd�||||�|
|�|d|
��dS|||�||d|�S||�}|t
|�r�|n||�S)z�Run a tick - one iteration of the scheduler.

        Executes one due task per call.

        Returns:
            float: preferred delay in seconds for next call.
        Nr�)rxr
)r�rirk�schedules_equalrlr:�copyr�rH�reserver�rxr�r)r/r!�min�heappop�heappushr�ri�H�eventr$rHr��verifyZ
next_entryZadjusted_next_time_to_runr)r)r*�tickEs8	
�
�
�zScheduler.tickcCs�||urdurnndS|dus,|dur0dSt|���t|���krLdS|��D]*\}}|�|�}|spdS||krTdSqTdS)NTF)�set�keysrK�get)r/Z
old_schedulesZ
new_schedulesr7Z	old_entry�	new_entryr)r)r*r�ms
zScheduler.schedules_equalcCs.|jp,t��|j|jkp,|jo,|j|jkSr2)�
_last_syncr"�	monotonic�
sync_everyrm�_tasks_since_syncr4r)r)r*�should_sync|s�
�zScheduler.should_synccCst|�}|j|j<|Sr2)rZr:r7)r/r$r�r)r)r*r��szScheduler.reserveTc	
KsR|r|�|�n|}|jj�|j�}�zz�t|j�}t|j�}|r||j	||fd|i|j
��WW|jd7_|��rz|�
�S|j|j||fd|i|j
��WW|jd7_|��r�|�
�SWnHt�y}z.tttdj||d��t��d�WYd}~n
d}~00W|jd7_|���rN|�
�n"|jd7_|���rL|�
�0dS)Nrxr
z-Couldn't apply scheduled task {0.name}: {exc})r�r�)r�r6�tasksr�r8r`r,rdr-r}r9r�r��_do_sync�	send_taskr~rrrN�sysr{)	r/r$rxryr-r8r_rcr�r)r)r*r}�sL

��������
�

�
zScheduler.apply_asynccOs|jj|i|��Sr2)r6r��r/r,r-r)r)r*r��szScheduler.send_taskcCs |�|j�|�|jjj�dSr2)rwrf�
merge_inplacer6rg�
beat_scheduler4r)r)r*rn�szScheduler.setup_schedulecCs<z$td�|��Wt��|_d|_nt��|_d|_0dS)Nzbeat: Synchronizing schedule...r)r��syncr"r�r�r�r4r)r)r*r��s

�
zScheduler._do_synccCsdSr2r)r4r)r)r*r��szScheduler.synccCs|��dSr2)r�r4r)r)r*�close�szScheduler.closecKs&|jfd|ji|��}||j|j<|S)Nr6)�Entryr6r:r7)r/r-r$r)r)r*�add�sz
Scheduler.addcCs4t||j�r|j|_|S|jfit|||jd���S�N)r7r6)rQr�r6rA)r/r7r$r)r)r*�_maybe_entry�szScheduler._maybe_entrycs"�j��fdd�|��D��dS)Ncsi|]\}}|��||��qSr))r�)r\r7r$r4r)r*rb�s�z.Scheduler.update_from_dict.<locals>.<dictcomp>)r:rErK)r/Zdict_r)r4r*ru�s�zScheduler.update_from_dictc	Cs�|j}t|�t|�}}||AD]}|�|d�q |D]F}|jfit||||jd���}|�|�rt||�|�q6|||<q6dSr�)r:r��popr�rAr6r�rE)r/�br:�A�B�keyr$r)r)r*r��s 
zScheduler.merge_inplacecCsdd�}|j�||jjj�S)NcSstd||�dS)Nz9beat: Connection error: %s. Trying again in %s seconds...)r)r��intervalr)r)r*�_error_handler�s�z3Scheduler._ensure_connected.<locals>._error_handler)�
connectionZensure_connectionr6rgZbroker_connection_max_retries)r/r�r)r)r*�_ensure_connected�s
�zScheduler._ensure_connectedcCs|jSr2�rfr4r)r)r*�get_schedule�szScheduler.get_schedulecCs
||_dSr2r��r/r:r)r)r*�set_schedule�szScheduler.set_schedulecCs
|j��Sr2)r6Zconnection_for_writer4r)r)r*r��szScheduler.connectioncCs|j|��dd�S)NF)Zauto_declare)rjr�r4r)r)r*rx�szScheduler.producercCsdS)N�r)r4r)r)r*r|�szScheduler.info)NNNFN)N)r�)NT)2r%r&r'r(rr�r:�DEFAULT_MAX_INTERVALrir�rmr�r��loggerr1rwr�r�rHrr�r!�heapqr�r�r�r�r�r�r�r�r�r}r�rnr�r�r�r�r�rur�r�r�r��propertyrr�rxr|r)r)r)r*r�sX
�



�
(



rcs�eZdZdZeZdZdZ�fdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zeee�Zdd�Zdd�Zedd��Z�ZS)rz+Scheduler backed by :mod:`shelve` database.)r�z.dbz.datz.bakz.dirNcs"|�d�|_t�j|i|��dS)N�schedule_filename)r�r��superr1r��r@r)r*r1szPersistentScheduler.__init__c	CsL|jD]@}t�tj�� t�|j|�Wd�q1s<0YqdSr2)�known_suffixesrZignore_errno�errno�ENOENT�os�remover�)r/�suffixr)r)r*�
_remove_dbs
zPersistentScheduler._remove_dbcCs|jj|jdd�S)NT)Z	writeback)�persistence�openr�r4r)r)r*�_open_schedule	sz"PersistentScheduler._open_schedulecCs"td|j|dd�|��|��S)Nz'Removing corrupted schedule file %r: %rTrz)rr�r�r�)r/r�r)r)r*� _destroy_open_corrupted_schedules
�z4PersistentScheduler._destroy_open_corrupted_schedulec
CsFz|��|_|j��Wn0tyH}z|�|�|_WYd}~n
d}~00|��|jjj}|j�	d�}|dur�||kr�t
d||�|j��|jjj}|j�	d�}|dur�||kr�ddd�}t
d||||�|j��|j�
di�}|�|jjj�|�|j�|j�t||d	��|��td
d�dd
�|��D���dS)N�tzz%Reset: Timezone changed from %r to %r�utc_enabled�enabled�disabled)TFz Reset: UTC changed from %s to %srv)rr�r�zCurrent schedule:
�
css|]}t|�VqdSr2)�repr)r\r$r)r)r*�	<genexpr>5sz5PersistentScheduler.setup_schedule.<locals>.<genexpr>)r��_storer�r~r��_create_scheduler6rg�timezoner��warning�clearZ
enable_utc�
setdefaultr�r�rwr:rErr�r��joinr�)r/r�r�Z	stored_tz�utcZ
stored_utc�choicesrvr)r)r*rns>
"



�
��z"PersistentScheduler.setup_schedulecCs�dD]�}z|jdWnrtttfy�zi|jd<WnJtttftjy�}z&|�|�|_WYd}~YqWYd}~n
d}~00YnZ0d|jvr�td�|j��n:d|jvr�td�|j��nd|jvr�td�|j��q�qdS)	N)r
r�rvrz+DB Reset: Account for new __version__ fieldr�z"DB Reset: Account for new tz fieldr�z+DB Reset: Account for new utc_enabled field)	r��KeyError�UnicodeDecodeError�	TypeError�dbmrr�r�r�)r/�_r�r)r)r*r�8s&*



z$PersistentScheduler._create_schedulecCs
|jdS�Nrv�r�r4r)r)r*r�Osz PersistentScheduler.get_schedulecCs||jd<dSr�r�r�r)r)r*r�Rsz PersistentScheduler.set_schedulecCs|jdur|j��dSr2)r�r�r4r)r)r*r�Vs
zPersistentScheduler.synccCs|��|j��dSr2)r�r�r�r4r)r)r*r�ZszPersistentScheduler.closecCsd|j��S)Nz    . db -> )r�r4r)r)r*r|^szPersistentScheduler.info)r%r&r'r(�shelver�r�r�r1r�r�r�rnr�r�r�r�r:r�r�r|�
__classcell__r)r)r�r*r�s"&
rc@sXeZdZdZeZddd�Zdd�Zddd	�Zd
d�Z	ddd
�Z
ddd�Zedd��Z
dS)rzCelery periodic task service.NcCsB||_|p|jj|_|p|j|_|p*|jj|_t�|_t�|_	dSr2)
r6rgrhri�
scheduler_clsZbeat_schedule_filenamer�r�_is_shutdown�_is_stopped)r/r6rir�r�r)r)r*r1hs�
�zService.__init__cCs|j|j|j|j|jffSr2)r@rir�r�r6r4r)r)r*rCts�zService.__reduce__Fc	Cs�td�tdt|jj��tjj|d�|rDtjj|d�t	�
d�z�zV|j��s�|j�
�}|rH|dkrHtdt|dd��t�|�|j��rH|j��qHWn ttfy�|j��Yn0W|��n
|��0dS)	Nzbeat: Starting...z#beat: Ticking with max interval->%s)Zsenderzcelery beatgzbeat: Waking up %s.zin )�prefix)r|r�r�	schedulerrirZ	beat_init�sendZbeat_embedded_initrZset_process_titler��is_setr�r"�sleepr�r��KeyboardInterrupt�
SystemExitr�r�)r/�embedded_processr�r)r)r*�startxs*
�



�

z
Service.startcCs|j��|j��dSr2)r�r�r�r�r4r)r)r*r��s
zService.synccCs$td�|j��|o|j��dS)Nzbeat: Shutting down...)r|r�r�r��wait)r/r�r)r)r*�stop�s
zService.stop�celery.beat_schedulerscCs0|j}tt|��}t|j|d�|j||j|d�S)N)�aliases)r6r�riro)r�rArrr�r6ri)r/roZextension_namespace�filenamer�r)r)r*�
get_scheduler�s�zService.get_schedulercCs|��Sr2)r�r4r)r)r*r��szService.scheduler)NNN)F)F)Fr�)r%r&r'r(rr�r1rCr�r�r�r�rr�r)r)r)r*rcs�


�
rcs0eZdZdZ�fdd�Zdd�Zdd�Z�ZS)�	_Threadedz(Embedded task scheduler using threading.cs2t���||_t|fi|��|_d|_d|_dS)NT�Beat)r�r1r6r�service�daemonr7�r/r6r-r�r)r*r1�s

z_Threaded.__init__cCs|j��|j��dSr2)r6�set_currentrr�r4r)r)r*�run�s
z
_Threaded.runcCs|jjdd�dS)NT)r�)rr�r4r)r)r*r��sz_Threaded.stop)r%r&r'r(r1rr�r�r)r)r�r*r�srcs,eZdZ�fdd�Zdd�Zdd�Z�ZS)�_Processcs,t���||_t|fi|��|_d|_dS)Nr)r�r1r6rrr7rr�r)r*r1�s
z_Process.__init__cCsPtdd�t�tjtjtjgtt���|j	�
�|j	��|jj
dd�dS)NF)�fullT)r�)rrZclose_open_fdsr��	__stdin__�
__stdout__�
__stderr__�listrr6�set_defaultrrr�r4r)r)r*r�s
��

z_Process.runcCs|j��|��dSr2)rr��	terminater4r)r)r*r��s
z
_Process.stop)r%r&r'r1rr�r�r)r)r�r*r�s	rcKs<|�dd�stdur(t|fddi|��St|fd|i|��S)z�Return embedded clock service.

    Arguments:
        thread (bool): Run threaded instead of as a separate process.
            Uses :mod:`multiprocessing` by default, if available.
    �threadFNrir
)r�rr)r6rir-r)r)r*r �sr )N)Hr(r�r�r�r�r�r�r�r"r��calendarr�collectionsr�	functoolsr�	threadingrrZbilliardrZbilliard.commonrZbilliard.contextr	Zkombu.utils.functionalr
rZkombu.utils.objectsrr�rrr�
exceptionsrZ	schedulesrrZutils.functionalrZ
utils.importsrrZ	utils.logrrZ
utils.timerr�__all__r!r%r�r�r|rr�r�r~rr+rr`rdrrrr�NotImplementedErrorrr r)r)r)r*�<module>sd
�w		 kF