Sorry to bother with so many messages, but I think this is going somewhere. 

I've found the problem: it's the max_empty_runs parameter.
I changed it to 10 (I was using it in 3) and it started working: the 
scheduler started executing the task accordingly to the period speficied in 
the task. 
Then I changed it back to 3, and again the problem, the task wasn't 
executed. 
I've found that the limit is 7. Any number below 7 causes the problem. 7 or 
more is ok. 
Heartbet is the default value. 

I made a simple test. Having a task queued, I run the worker with 
max_empty_runs=6 and then =7.

Here is the log with max_empty_runs=6:

starting single-scheduler for "webmedios"...
DEBUG:pyDAL:Your database version does not support the JSON data type (using 
TEXT instead)
DEBUG:web2py.scheduler.medios#27764:defining tables (migrate=True)
DEBUG:web2py.scheduler.medios#27764:thread building own DAL object
DEBUG:web2py.scheduler.medios#27764:looping...
DEBUG:pyDAL:Your database version does not support the JSON data type (using 
TEXT instead)
DEBUG:web2py.scheduler.medios#27764:defining tables (migrate=False)
DEBUG:web2py.scheduler.medios#27764:    freeing workers that have not sent 
heartbeat
INFO:web2py.scheduler.medios#27764:nothing to do
DEBUG:web2py.scheduler.medios#27764:sleeping...
DEBUG:web2py.scheduler.medios#27764:empty runs 1/6
INFO:web2py.scheduler.medios#27764:TICKER: I'm a ticker
DEBUG:web2py.scheduler.medios#27764:looping...
DEBUG:web2py.scheduler.medios#27764:Assigning tasks...
INFO:web2py.scheduler.medios#27764:TICKER: workers are 1
INFO:web2py.scheduler.medios#27764:TICKER: tasks are 0
DEBUG:web2py.scheduler.medios#27764:Tasks assigned...
DEBUG:web2py.scheduler.medios#27764:sleeping...
DEBUG:web2py.scheduler.medios#27764:empty runs 2/6
DEBUG:web2py.scheduler.medios#27764:........recording heartbeat (ACTIVE)
DEBUG:web2py.scheduler.medios#27764:looping...
INFO:web2py.scheduler.medios#27764:nothing to do
DEBUG:web2py.scheduler.medios#27764:sleeping...
DEBUG:web2py.scheduler.medios#27764:empty runs 3/6
DEBUG:web2py.scheduler.medios#27764:........recording heartbeat (ACTIVE)
DEBUG:web2py.scheduler.medios#27764:looping...
INFO:web2py.scheduler.medios#27764:nothing to do
DEBUG:web2py.scheduler.medios#27764:sleeping...
DEBUG:web2py.scheduler.medios#27764:empty runs 4/6
DEBUG:web2py.scheduler.medios#27764:........recording heartbeat (ACTIVE)
DEBUG:web2py.scheduler.medios#27764:looping...
INFO:web2py.scheduler.medios#27764:nothing to do
DEBUG:web2py.scheduler.medios#27764:sleeping...
DEBUG:web2py.scheduler.medios#27764:empty runs 5/6
DEBUG:web2py.scheduler.medios#27764:........recording heartbeat (ACTIVE)
DEBUG:web2py.scheduler.medios#27764:looping...
INFO:web2py.scheduler.medios#27764:nothing to do
DEBUG:web2py.scheduler.medios#27764:sleeping...
DEBUG:web2py.scheduler.medios#27764:empty runs 6/6
INFO:web2py.scheduler.medios#27764:empty runs limit reached, killing myself
INFO:web2py.scheduler.medios#27764:die!


And here the log with max_empty_runs=7:

starting single-scheduler for "webmedios"...

DEBUG:pyDAL:Your database version does not support the JSON data type (using 
TEXT instead)
DEBUG:web2py.scheduler.medios#27801:defining tables (migrate=True)
DEBUG:web2py.scheduler.medios#27801:thread building own DAL object
DEBUG:web2py.scheduler.medios#27801:looping...
DEBUG:pyDAL:Your database version does not support the JSON data type (using 
TEXT instead)
DEBUG:web2py.scheduler.medios#27801:defining tables (migrate=False)
DEBUG:web2py.scheduler.medios#27801:    freeing workers that have not sent 
heartbeat
INFO:web2py.scheduler.medios#27801:nothing to do
DEBUG:web2py.scheduler.medios#27801:sleeping...
DEBUG:web2py.scheduler.medios#27801:empty runs 1/7
INFO:web2py.scheduler.medios#27801:TICKER: I'm a ticker
DEBUG:web2py.scheduler.medios#27801:looping...
DEBUG:web2py.scheduler.medios#27801:Assigning tasks...
DEBUG:web2py.scheduler.medios#27801:........recording heartbeat (ACTIVE)
INFO:web2py.scheduler.medios#27801:TICKER: workers are 1
INFO:web2py.scheduler.medios#27801:TICKER: tasks are 0
DEBUG:web2py.scheduler.medios#27801:Tasks assigned...
DEBUG:web2py.scheduler.medios#27801:sleeping...
DEBUG:web2py.scheduler.medios#27801:empty runs 2/7
DEBUG:web2py.scheduler.medios#27801:looping...
DEBUG:web2py.scheduler.medios#27801:........recording heartbeat (ACTIVE)
INFO:web2py.scheduler.medios#27801:nothing to do
DEBUG:web2py.scheduler.medios#27801:sleeping...
DEBUG:web2py.scheduler.medios#27801:empty runs 3/7
DEBUG:web2py.scheduler.medios#27801:looping...
DEBUG:web2py.scheduler.medios#27801:........recording heartbeat (ACTIVE)
INFO:web2py.scheduler.medios#27801:nothing to do
DEBUG:web2py.scheduler.medios#27801:sleeping...
DEBUG:web2py.scheduler.medios#27801:empty runs 4/7
DEBUG:web2py.scheduler.medios#27801:looping...
INFO:web2py.scheduler.medios#27801:nothing to do
DEBUG:web2py.scheduler.medios#27801:sleeping...
DEBUG:web2py.scheduler.medios#27801:........recording heartbeat (ACTIVE)
DEBUG:web2py.scheduler.medios#27801:empty runs 5/7
DEBUG:web2py.scheduler.medios#27801:looping...
INFO:web2py.scheduler.medios#27801:nothing to do
DEBUG:web2py.scheduler.medios#27801:sleeping...
DEBUG:web2py.scheduler.medios#27801:empty runs 6/7
DEBUG:web2py.scheduler.medios#27801:........recording heartbeat (ACTIVE)
DEBUG:web2py.scheduler.medios#27801:    freeing workers that have not sent 
heartbeat
INFO:web2py.scheduler.medios#27801:TICKER: I'm a ticker
DEBUG:web2py.scheduler.medios#27801:looping...
DEBUG:web2py.scheduler.medios#27801:Assigning tasks...
INFO:web2py.scheduler.medios#27801:TICKER: workers are 1
INFO:web2py.scheduler.medios#27801:TICKER: tasks are 1
DEBUG:web2py.scheduler.medios#27801:Tasks assigned...
DEBUG:web2py.scheduler.medios#27801:sleeping...
DEBUG:web2py.scheduler.medios#27801:empty runs 1/7
DEBUG:web2py.scheduler.medios#27801:........recording heartbeat (ACTIVE)
DEBUG:web2py.scheduler.medios#27801:looping...
DEBUG:web2py.scheduler.medios#27801:   work to do 1
DEBUG:web2py.scheduler.medios#27801:    new scheduler_run record
DEBUG:web2py.scheduler.medios#27801:........recording heartbeat (ACTIVE)
INFO:web2py.scheduler.medios#27801:new task 1 "mytest" demo.mytest
DEBUG:web2py.scheduler.medios#27801: new task allocated: demo.mytest
DEBUG:web2py.scheduler.medios#27801:   task starting
DEBUG:web2py.scheduler.medios#27801:    task started
DEBUG:web2py.scheduler.medios#27801:    new task report: COMPLETED
DEBUG:web2py.scheduler.medios#27801:   result: true
DEBUG:web2py.scheduler.medios#27801:  task completed or failed
DEBUG:web2py.scheduler.medios#27801: recording task report in db (COMPLETED)
INFO:web2py.scheduler.medios#27801:task completed (COMPLETED)
DEBUG:web2py.scheduler.medios#27801:looping...
INFO:web2py.scheduler.medios#27801:nothing to do
DEBUG:web2py.scheduler.medios#27801:sleeping...
DEBUG:web2py.scheduler.medios#27801:empty runs 1/7
DEBUG:web2py.scheduler.medios#27801:........recording heartbeat (ACTIVE)
DEBUG:web2py.scheduler.medios#27801:looping...
.... continues to run 7.


I don't know if it is a bug or not. In this simple test I've found that:

if max_empty_runs<7 then
    if web2py.version is 2.10.3 then 
        periodic tasks won't be executed (or will be exectued every random 
time, much larger than the period specified). 
    elif web2py.version is 2.10.4 then
        periodic task will be executed correctly
elif max_empty_runs>=7 then
    periodic task will be executed correctly

:/

El miércoles, 13 de mayo de 2015, 11:37:22 (UTC-3), Lisandro escribió:
>
> Recreating the scheduler tables doesn't work.
>
> I've found a little difference between the logs on the server (where 
> scheduler doesn't work) and the logs on localhost (where it does work). 
> This line is present only on the server log:
>
> DEBUG:pyDAL:Your database version does not support the JSON data type (
> using TEXT instead)
>
> The server is running PostgreSQL 9.1.15 + psycopg 2.4.5 + web2py 2.10.3
> Localhost is running PostgreSQL 9.3.6 + psycopg 2.4.5 + web2py 2.10.4
>
>
> Here is the complete log on server:
>
> starting single-scheduler for "webmedios"...
> DEBUG:pyDAL:Your database version does not support the JSON data type (
> using TEXT instead)
> DEBUG:web2py.scheduler.medios#24872:defining tables (migrate=True)
> DEBUG:web2py.scheduler.medios#24872:thread building own DAL object
> DEBUG:web2py.scheduler.medios#24872:looping...
> DEBUG:pyDAL:Your database version does not support the JSON data type (
> using TEXT instead)
> DEBUG:web2py.scheduler.medios#24872:defining tables (migrate=False)
> INFO:web2py.scheduler.medios#24872:nothing to do
> DEBUG:web2py.scheduler.medios#24872:sleeping...
> DEBUG:web2py.scheduler.medios#24872:empty runs 1/3
> DEBUG:web2py.scheduler.medios#24872:    freeing workers that have not 
> sent heartbeat
> INFO:web2py.scheduler.medios#24872:TICKER: I'm a ticker
> DEBUG:web2py.scheduler.medios#24872:looping...
> DEBUG:web2py.scheduler.medios#24872:Assigning tasks...
> INFO:web2py.scheduler.medios#24872:TICKER: workers are 1
> INFO:web2py.scheduler.medios#24872:TICKER: tasks are 0
> DEBUG:web2py.scheduler.medios#24872:Tasks assigned...
> DEBUG:web2py.scheduler.medios#24872:sleeping...
> DEBUG:web2py.scheduler.medios#24872:empty runs 2/3
> DEBUG:web2py.scheduler.medios#24872:........recording heartbeat (ACTIVE)
> DEBUG:web2py.scheduler.medios#24872:looping...
> INFO:web2py.scheduler.medios#24872:nothing to do
> DEBUG:web2py.scheduler.medios#24872:sleeping...
> DEBUG:web2py.scheduler.medios#24872:empty runs 3/3
> INFO:web2py.scheduler.medios#24872:empty runs limit reached, killing 
> myself
> INFO:web2py.scheduler.medios#24872:die!
>
>
>
> And here the complete log on localhost:
>
> starting single-scheduler for "webmedios"...
> DEBUG:web2py.scheduler.notebook#7049:defining tables (migrate=True)
> DEBUG:web2py.scheduler.notebook#7049:thread building own DAL object
> DEBUG:web2py.scheduler.notebook#7049:looping...
> DEBUG:web2py.scheduler.notebook#7049:defining tables (migrate=False)
> DEBUG:web2py.scheduler.notebook#7049:    freeing workers that have not 
> sent heartbeat
> INFO:web2py.scheduler.notebook#7049:TICKER: I'm a ticker
> INFO:web2py.scheduler.notebook#7049:nothing to do
> DEBUG:web2py.scheduler.notebook#7049:sleeping...
> DEBUG:web2py.scheduler.notebook#7049:empty runs 1/3
> DEBUG:web2py.scheduler.notebook#7049:looping...
> DEBUG:web2py.scheduler.notebook#7049:Assigning tasks...
> DEBUG:web2py.scheduler.notebook#7049:........recording heartbeat (ACTIVE)
> INFO:web2py.scheduler.notebook#7049:TICKER: workers are 1
> INFO:web2py.scheduler.notebook#7049:TICKER: tasks are 1
> DEBUG:web2py.scheduler.notebook#7049:Tasks assigned...
> DEBUG:web2py.scheduler.notebook#7049:sleeping...
> DEBUG:web2py.scheduler.notebook#7049:empty runs 1/3
> DEBUG:web2py.scheduler.notebook#7049:........recording heartbeat (ACTIVE)
> DEBUG:web2py.scheduler.notebook#7049:looping...
> DEBUG:web2py.scheduler.notebook#7049:   work to do 2
> DEBUG:web2py.scheduler.notebook#7049:    new scheduler_run record
> INFO:web2py.scheduler.notebook#7049:new task 2 "mytest" demo.mytest
> DEBUG:web2py.scheduler.notebook#7049: new task allocated: demo.mytest
> DEBUG:web2py.scheduler.notebook#7049:   task starting
> DEBUG:web2py.scheduler.notebook#7049:    task started
> DEBUG:web2py.scheduler.notebook#7049:    new task report: COMPLETED
> DEBUG:web2py.scheduler.notebook#7049:   result: true
> DEBUG:web2py.scheduler.notebook#7049:  task completed or failed
> DEBUG:web2py.scheduler.notebook#7049: recording task report in db 
> (COMPLETED)
> INFO:web2py.scheduler.notebook#7049:task completed (COMPLETED)
> DEBUG:web2py.scheduler.notebook#7049:looping...
> INFO:web2py.scheduler.notebook#7049:nothing to do
> DEBUG:web2py.scheduler.notebook#7049:sleeping...
> DEBUG:web2py.scheduler.notebook#7049:empty runs 1/3
> DEBUG:web2py.scheduler.notebook#7049:looping...
> DEBUG:web2py.scheduler.notebook#7049:........recording heartbeat (ACTIVE)
> INFO:web2py.scheduler.notebook#7049:nothing to do
> DEBUG:web2py.scheduler.notebook#7049:sleeping...
> DEBUG:web2py.scheduler.notebook#7049:empty runs 2/3
> DEBUG:web2py.scheduler.notebook#7049:looping...
> DEBUG:web2py.scheduler.notebook#7049:........recording heartbeat (ACTIVE)
> INFO
> ...

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to