Sorry to say that wasn't completely the solution :/

Don't know exactly why, it ran ok during some minutes, and then I see that 
tasks didn't get executed.

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

It apperas to be all ok, however there are queued tasks and they aren't 
being executed.
Am I missing something?




El lunes, 11 de mayo de 2015, 21:15:03 (UTC-3), Lisandro escribió:
>
> I have *one master app* that handles the *main db, in which the scheduler 
> tables have been created*.
>
> This master app has a scheduler.py module that looks like this (for now, 
> with no function tasks defined):
>
> # -*- coding: utf-8 -*-
> from gluon.scheduler import Scheduler
> scheduler = Scheduler(db, max_empty_runs=5)
>
>
> In the other hand, I have *multiple secondary apps*, each one with it's 
> own db. 
> All this applications *instantiate the scheduler specifying the central 
> db*, like this:
>
> def test():
>     print 'this is just a test task'
>     return True
>
> from gluon.scheduler import Scheduler
> db_scheduler = DAL('postgres://user:password@host/centraldb', 
> lazy_tables=True, migrate=False)
> scheduler = Scheduler(db_scheduler, max_empty_runs=5)
>
>
> Then, *the tasks are queued from the master app*, like this:
>
> scheduler.queue_task('test', period=60, repeats=0, application_name='app1')
> scheduler.queue_task('test', period=60, repeats=0, application_name='app2')
> scheduler.queue_task('test', period=60, repeats=0, application_name='app3')
>
>
> Then, I start the scheduler like this (from unix cron, every 5 minutes or 
> so):
>
> python /home/user/web2py/web2py.py -K app1,app2,app3
>
> I can see the task moves to "RUNNING" state, but *the task stucks running 
> until the configured timeout*.
>
> Am I using correctly the "application_name" parameter of the 
> "queue_task()" function? 
> I assume that the scheduler will pick up the task and check for that 
> field, so the task function will be called in the context of the 
> corresponding application.
>
> Notice that the scheduler.py model of the master app doesn't have any 
> function defined.  Instead, taks functions are defined in the scheduler.py 
> model of every secondary app. That's why, when I queue a task, I specify 
> the application_name... However, at the end, the scheduler shows that the 
> task is running (when it's not actually), and then the timeout.
>
> Any help will be really appreciated!
>

-- 
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