o
    wvXj  ã                   @   sx   d Z ddlmZmZ ddlmZ ddlmZmZ ddl	m
Z
mZ dZe ZG dd„ deƒZdd
d„Zedkr:eƒ  d	S d	S )aÓ  The :program:`celery beat` command.

.. program:: celery beat

.. seealso::

    See :ref:`preload-options` and :ref:`daemon-options`.

.. cmdoption:: --detach

    Detach and run in the background as a daemon.

.. cmdoption:: -s, --schedule

    Path to the schedule database.  Defaults to `celerybeat-schedule`.
    The extension '.db' may be appended to the filename.
    Default is {default}.

.. cmdoption:: -S, --scheduler

    Scheduler class to use.
    Default is :class:`{default}`.

.. cmdoption:: --max-interval

    Max seconds to sleep between schedule iterations.

.. cmdoption:: -f, --logfile

    Path to log file.  If no logfile is specified, `stderr` is used.

.. cmdoption:: -l, --loglevel

    Logging level, choose between `DEBUG`, `INFO`, `WARNING`,
    `ERROR`, `CRITICAL`, or `FATAL`.

.. cmdoption:: --pidfile

    File used to store the process pid. Defaults to `celerybeat.pid`.

    The program won't start if this file already exists
    and the pid is still alive.

.. cmdoption:: --uid

    User id, or user name of the user to run as after detaching.

.. cmdoption:: --gid

    Group id, or group name of the main group to change to after
    detaching.

.. cmdoption:: --umask

    Effective umask (in octal) of the process after detaching.  Inherits
    the umask of the parent process by default.

.. cmdoption:: --workdir

    Optional directory to change to after detaching.

.. cmdoption:: --executable

    Executable to use for the detached process.
é    )Úabsolute_importÚunicode_literals)Úpartial)ÚCommandÚdaemon_options)ÚdetachedÚmaybe_drop_privileges)Úbeatc                   @   s2   e Zd ZdZeZdZdZ		d	dd„Zdd„ Z	dS )
r	   aI  Start the beat periodic task scheduler.

    Examples:
        .. code-block:: console

            $ celery beat -l info
            $ celery beat -s /var/run/celery/beat-schedule --detach
            $ celery beat -S django

    The last example requires the :pypi:`django-celery-beat` extension
    package found on PyPI.
    TFNc           
      K   s„   |st ||d� | dd ¡ t| jjf||dœ|¤Ž}	|r=t||||||ƒ� |	ƒ  ¡ W  d   ƒ S 1 s6w   Y  d S |	ƒ  ¡ S )N)ÚuidÚgidÚapp)ÚlogfileÚpidfile)r   Úpopr   r   ÚBeatr   Úrun)
ÚselfÚdetachr   r   r
   r   ÚumaskÚworkdirÚkwargsr	   © r   úL/var/www/html/myproject/venv/lib/python3.10/site-packages/celery/bin/beat.pyr   a   s   
ÿÿ$ÿ
zbeat.runc                 C   sž   | j j}| d¡}|jdddd� |jdd|jd� |jd	td
� |jdd|jd� |jdddd� t|dd� | j jd }|rM| d¡}|  	||¡ d S d S )NzBeat Optionsz--detachÚ
store_trueF)ÚactionÚdefaultz-sz
--schedule)r   z--max-interval)Útypez-Sz--schedulerz-lz
--loglevelÚWARNzcelerybeat.pid)Údefault_pidfiler	   zUser Options)
r   ÚconfÚadd_argument_groupÚadd_argumentÚbeat_schedule_filenameÚfloatÚbeat_schedulerr   Úuser_optionsÚadd_compat_options)r   ÚparserÚcÚboptsr%   Úuoptsr   r   r   Úadd_argumentso   s   
ÿ
þzbeat.add_arguments)FNNNNNN)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚHELPÚdocÚenable_config_from_cmdlineÚsupports_argsr   r+   r   r   r   r   r	   O   s    
ÿr	   Nc                 C   s   t | d� ¡  d S )N©r   )r	   Úexecute_from_commandliner4   r   r   r   Úmain�   s   r6   Ú__main__)N)r/   Ú
__future__r   r   Ú	functoolsr   Úcelery.bin.baser   r   Úcelery.platformsr   r   Ú__all__r0   r	   r6   r,   r   r   r   r   Ú<module>   s   A
2
ÿ