there's a problem, I think. 
max_empty_runs=5 means "do 5 loops, if you didn't pick or assign any tasks, 
die". 
you said your workers are started by a cron job every 2 minutes (god knows 
why, but that's your choice).
your instantiation doesn't touch the heartbeat parameter, which is by 
default 3 seconds.
this means that there is a "timeframe" of a taddle bit more than 15 seconds 
to pick up "ready to process tasks". 
Which, you said, are all there and ready to be processed.
A worker gets to rule out if he's an elegible "master" every 5 cycles (the 
"ticker" who dispatches tasks).
The problem I'm about to highlight is subtle... when a worker needs to rule 
out if he's an elegible master, he does also the "pruning" of dead workers.
First of all, as soon as it's started, a worker does this thing (i.e. at 
the very first loop). This means that if your workers are started every 2 
minutes, and there are ready to process tasks, at the very first round the 
worker would prune "the last worker that died doing nothing"
Now, if the last worker didn't process any task and shutted down, he'd be 
pruned as long as the last_heartbeat is 9 seconds (line 1015), because he'd 
still be marked as an ACTIVE worker.
This doesn't add up with what you're experiencing... a worker with 
max_empty_runs=5 started every 2 minutes would effectively have a worker 
pick up the tasks as soon as it's started.

This shouldn't happen......

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


tl;dr: glad that you sorted out, but I'm going to test things as they are 
in your environment to try to reproduce the erratic behaviour.

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