https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/boto/manage/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/boto/manage/__pycache__/task.cpython-310.pyc
o

ckF[}�@sxddlZddlmZmZmZddlmZddlZddlZddl	Z	ddl
mZdd�ZGdd�de�Z
Gd	d
�d
e�ZdS)�N)�StringProperty�DateTimeProperty�IntegerProperty)�Model)�StringIOcCs,|dkrdSt|�dkst|�dkrt�dS)N�*r�)�int�
ValueError)�val�r�2/usr/lib/python3/dist-packages/boto/manage/task.py�
check_hours
�rcs�eZdZdZe�Zededd�Zedd�Ze	�Z
e�Ze�Z
e�Zedd��Zd�fd	d
�	Zdd�Zd
d�Zddd�Zdd�Z�ZS)�Taska�
    A scheduled, repeating task that can be executed by any participating servers.
    The scheduling is similar to cron jobs.  Each task has an hour attribute.
    The allowable values for hour are [0-23|*].

    To keep the operation reasonably efficient and not cause excessive polling,
    the minimum granularity of a Task is hourly.  Some examples:

         hour='*' - the task would be executed each hour
         hour='3' - the task would be executed at 3AM GMT each day.

    Tr)�required�	validator�default)rcCs|��D]}|�|�qdS�N)�all�start)�cls�
queue_name�taskrrr
�	start_all9s�zTask.start_allNcs@tt|�j|fi|��|jdk|_|jdk|_tj��|_dS)Nr)	�superr�__init__�hour�hourly�daily�datetime�utcnow�now)�self�id�kw��	__class__rr
r>sz
Task.__init__cCs�tj�d|j|j|jf�|jr|jsdS|jr>|js>t|j	�|jj	kr'dSt
t|j	�|jj	|jj	t|j	��ddS|j|j}|jrS|jdkrNdSd|jSt|j	�|jj	kre|jdkrcdSdSt
t|j	�|jj	|jj	t|j	��ddS)ag
        Determine how long until the next scheduled time for a Task.
        Returns the number of seconds until the next scheduled time or zero
        if the task needs to be run immediately.
        If it's an hourly task and it's never been run, run it now.
        If it's a daily task and it's never been run and the hour is right, run it now.
        z!checking Task[%s]-now=%s, last=%sr�<i�ipC)
�boto�log�info�namer!�
last_executedrrr	r�max�seconds�days)r"�deltarrr
�checkDs".


.z
Task.checkcCstj�d|j|jf�t�}tj|jdtjtjtjd�}d}|}|�	�durZtj�d||f�||krK||7}tj�d|j|f�|rK|�
|�t�d�|d7}|�	�dus'|�
�}|�|d�|�|d�tj�d	|j|��f�|j|_|j|_|��dd
�|_dS)NzTask[%s] - running:%sT)�shell�stdin�stdout�stderr�znsecs=%s, timeout=%sz(Task[%s] - setting timeout to %d secondsrr(zTask[%s] - output: %si�)r)r*r+r,�commandr�
subprocess�Popen�PIPE�poll�change_visibility�time�sleep�communicate�write�getvaluer!r-�
returncode�last_status�last_output)r"�msg�vtimeout�log_fp�process�nsecs�current_timeout�trrr
�_runfs0�

�	z	Task._runr'cCs�|��}tj�d|j|f�|dkrM|�||�|j}|�|j�}|�	|�}|j|_
|��tj�d|j|jf�|��tj�d|j|jf�dStj�d|�|�
|�dS)NzTask[%s] - delay=%s secondsrzTask[%s] - new message id=%szTask[%s] - deleted message %sznew_vtimeout: %d)r2r)r*r+r,rM�queue�new_messager#rA�
message_id�put�deleter=)r"rFrG�delayrN�new_msgrrr
�run~s
zTask.runcCs^tj�d|j|f�t�d|�}|�|j�}|�|�}|j|_|�	�tj�d|j�dS)Nz"Task[%s] - starting with queue: %s�sqszTask[%s] - start successful)
r)r*r+r,�lookuprOr#rArPrQ)r"rrNrFrrr
r�s
z
Task.startr)r')�__name__�
__module__�__qualname__�__doc__rr,rrr8rr-rrDrErP�classmethodrrr2rMrUr�
__classcell__rrr%r
r#s 

"
rc@seZdZdd�Zddd�ZdS)�
TaskPollercCst��|_|j�|�|_dSr)r)�connect_sqsrVrWrN)r"rrrr
r�s
zTaskPoller.__init__r'cCs|	|j�|�}|r8t�|���}|r7|jr|j|jkr.tj�	d|j
|jf�|�||�ntj�	d|j
�nt�
|�q)NTzTask[%s] - read message %sz-Task[%s] - found extraneous message, ignoring)rN�readr�	get_by_id�get_bodyrPr#r)r*r+r,rUr>r?)r"�waitrG�mrrrr
r<�s�
�zTaskPoller.pollN)r'r')rXrYrZrr<rrrr
r^�sr^)r)�boto.sdb.db.propertyrrr�boto.sdb.db.modelrrr9r>�boto.compatrrr�objectr^rrrr
�<module>su

https://t.me/RX1948 - 2025