o
    ;i                     @   s>   d dl mZ G dd dZG dd deZG dd deZdS )	    )api_pb2c                   @   s   e Zd ZdZdd ZdS )SchedulezDSchedules represent a time frame to repeatedly run a Modal function.c                 C   s
   || _ d S )N)proto_message)selfr    r   B/home/ubuntu/.local/lib/python3.10/site-packages/modal/schedule.py__init__   s   
zSchedule.__init__N)__name__
__module____qualname____doc__r   r   r   r   r   r      s    r   c                       s2   e Zd ZdZ	d	dededdf fddZ  ZS )
Crona  Cron jobs are a type of schedule, specified using the
    [Unix cron tab](https://crontab.guru/) syntax.

    The alternative schedule type is the [`modal.Period`](https://modal.com/docs/reference/modal.Period).

    **Usage**

    ```python
    import modal
    app = modal.App()


    @app.function(schedule=modal.Cron("* * * * *"))
    def f():
        print("This function will run every minute")
    ```

    We can specify different schedules with cron strings, for example:

    ```python
    modal.Cron("5 4 * * *")  # run at 4:05am UTC every night
    modal.Cron("0 9 * * 4")  # runs every Thursday at 9am UTC
    ```

    We can also optionally specify a timezone, for example:

    ```python
    # Run daily at 6am New York time, regardless of whether daylight saving
    # is in effect (i.e. at 11am UTC in the winter, and 10am UTC in the summer):
    modal.Cron("0 6 * * *", timezone="America/New_York")
    ```

    If no timezone is specified, the default is UTC.
    UTCcron_stringtimezonereturnNc                    s(   t jj||d}t t j|d dS )zEConstruct a schedule that runs according to a cron expression string.)r   r   )cronN)r   r   r   superr   )r   r   r   r   	__class__r   r   r   0   s   zCron.__init__)r   )r	   r
   r   r   strr   __classcell__r   r   r   r   r      s    &r   c                       sT   e Zd ZdZdddddddddededededed	ed
eddf fddZ  ZS )Perioda  Create a schedule that runs every given time interval.

    **Usage**

    ```python
    import modal
    app = modal.App()

    @app.function(schedule=modal.Period(days=1))
    def f():
        print("This function will run every day")

    modal.Period(hours=4)          # runs every 4 hours
    modal.Period(minutes=15)       # runs every 15 minutes
    modal.Period(seconds=math.pi)  # runs every 3.141592653589793 seconds
    ```

    Only `seconds` can be a float. All other arguments are integers.

    Note that `days=1` will trigger the function the same time every day.
    This does not have the same behavior as `seconds=84000` since days have
    different lengths due to daylight savings and leap seconds. Similarly,
    using `months=1` will trigger the function on the same day each month.

    This behaves similar to the
    [dateutil](https://dateutil.readthedocs.io/en/latest/relativedelta.html)
    package.
    r   yearsmonthsweeksdayshoursminutessecondsr   r   r   r   r   r   r    r   Nc          	   	      s2   t jj|||||||d}t t j|d d S )Nr   )period)r   r   r   r   r   )	r   r   r   r   r   r   r   r    r!   r   r   r   r   X   s   	zPeriod.__init__)r	   r
   r   r   intfloatr   r   r   r   r   r   r   :   s4     	
r   N)modal_protor   r   r   r   r   r   r   r   <module>   s   .