[web2py] Re: Bug in gluon/scheduler.py

2022-08-21 Thread Dave S


On Saturday, August 20, 2022 at 11:39:55 AM UTC-7 Tom Clerckx wrote:

> Our tasks are added using scheduler.queue_task(...) function.
>
> By default, we set the period to 0 
>

Why?  If you don't know the period, why are you queuing it?   Or are you 
using the "cron" type of task scheduling? 

 

> Later on we added to the defaults : prevent_drift = True
>
> It's this last change that triggered the observed error.
>
>
Eveything I know about the scheduler has been shown to me by Stefan 
(Niphlod), who wrote the subsystem and the tests.  I suspect I would have 
to spend quite a bit of time to come up with an analysis of what is really 
wrong, but I'm really suspicious of queuing a period of 0.

/dps

 

>
>
>
>
> On Friday, August 19, 2022 at 12:49:05 PM UTC+2 snide...@gmail.com wrote:
>
>> On Monday, August 8, 2022 at 3:50:26 AM UTC-7 Tom Clerckx wrote:
>>
>>> Version:
>>> Version 2.22.5-stable+timestamp.2022.06.04.18.13.51
>>>
>>> There is a problem with the calculation of next_run_time in 
>>> gluon/scheduler.py at line 1024
>>>
>>> It calculates:
>>> steps = secondspassed // task.period + 1
>>>
>>> However, there is no check done for task.period being 0
>>>
>>> This can cause the following scheduler error:
>>> ZeroDivisionError: float divmod()
>>>
>>> I think it would be better to initialize next_run_time and change the 
>>> last else condition to "elif task.period".
>>>
>>
>> How did you get task.period == 0?
>>
>> I'm wondering if this is a valid use-case; the scheduler has quite a test 
>> suite.
>>
>> /dps
>>  
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/38a740d4-1fb5-4454-a825-da76b7220da2n%40googlegroups.com.


[web2py] Re: Bug in gluon/scheduler.py

2022-08-20 Thread Tom Clerckx
Our tasks are added using scheduler.queue_task(...) function.

By default, we set the period to 0 
Later on we added to the defaults : prevent_drift = True

It's this last change that triggered the observed error.







On Friday, August 19, 2022 at 12:49:05 PM UTC+2 snide...@gmail.com wrote:

> On Monday, August 8, 2022 at 3:50:26 AM UTC-7 Tom Clerckx wrote:
>
>> Version:
>> Version 2.22.5-stable+timestamp.2022.06.04.18.13.51
>>
>> There is a problem with the calculation of next_run_time in 
>> gluon/scheduler.py at line 1024
>>
>> It calculates:
>> steps = secondspassed // task.period + 1
>>
>> However, there is no check done for task.period being 0
>>
>> This can cause the following scheduler error:
>> ZeroDivisionError: float divmod()
>>
>> I think it would be better to initialize next_run_time and change the 
>> last else condition to "elif task.period".
>>
>
> How did you get task.period == 0?
>
> I'm wondering if this is a valid use-case; the scheduler has quite a test 
> suite.
>
> /dps
>  
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/26297db5-d87a-4810-bcaf-bb8711edbf0dn%40googlegroups.com.


[web2py] Re: Bug in gluon/scheduler.py

2022-08-19 Thread Dave S


On Monday, August 8, 2022 at 3:50:26 AM UTC-7 Tom Clerckx wrote:

> Version:
> Version 2.22.5-stable+timestamp.2022.06.04.18.13.51
>
> There is a problem with the calculation of next_run_time in 
> gluon/scheduler.py at line 1024
>
> It calculates:
> steps = secondspassed // task.period + 1
>
> However, there is no check done for task.period being 0
>
> This can cause the following scheduler error:
> ZeroDivisionError: float divmod()
>
> I think it would be better to initialize next_run_time and change the last 
> else condition to "elif task.period".
>

How did you get task.period == 0?

I'm wondering if this is a valid use-case; the scheduler has quite a test 
suite.

/dps
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/bb3962dc-6e9f-4d9b-8689-20a7e47cec54n%40googlegroups.com.