Anthony,
Thanks for the explanation, helps me understand scheduler better.
I will try the task configuration now.
This is my scheduler and task definition:
sched_db = DAL(...postgres...)
scheduler = Scheduler(heartbeat=20)
# Task A
scheduler.queue_task(functionc)
# Task B
scheduler.queue_task(functionb)
# Task C
scheduler.queue_task(functiona)
The function* are regular functions to send emails and such,
representing tasks A, B, C. I haven't set any of the task
configuration parameters; working with defaults.
What I couldn't understand was the timestamps at which the tasks
appear on the debug log. They seem to be running every second or
less than a second.
________________________________________
Kiran Subbaraman
http://subbaraman.wordpress.com/about/
On Wed, 02-04-2014 1:26 AM, Anthony wrote:
Can you provide more detail regarding how you added the
tasks and to what values you set the relevant parameters. The
heartbeat does not determine the frequency of tasks but the
frequency with which the scheduler checks the task queue for
the arrival of new tasks to assign to workers. To set the
frequency with which to repeat a recurring task, use the
"period" argument (possibly in conjunction with
"prevent_drift"). If you want a task to run approximately
every minute (but do not need exactly 60 per hour), set
repeats=0 (i.e., unlimited repeates) and set period=60 and
prevent_drift=False (which are the default values for both).
For a task that should run exactly once every 24 hours (at the
same time), set period=60*60*24 and prevent_drift=True.
Anthony
On Tuesday, April 1, 2014 2:29:19 PM UTC-4, Kiran Subbaraman
wrote:
Hello,
I have setup the scheduler to execute on three different
tasks
Task A, B, and C
Also, have setup the scheduler's heartbeat to 20seconds
There are no further specific configurations. It works well.
Have turned on the debug log, and notice that there is a
constant output from the tasks there:
2014-04-01 23:36:16,642 - web2py.app.myapp - DEBUG - result: "Done: Task A"
2014-04-01 23:36:17,407 - web2py.app.myapp - DEBUG - new task report: COMPLETED
2014-04-01 23:36:17,408 - web2py.app.myapp - DEBUG - result: "Done: Task B"
2014-04-01 23:36:18,180 - web2py.app.myapp - DEBUG - new task report: COMPLETED
2014-04-01 23:36:18,180 - web2py.app.myapp - DEBUG - result: "Done: Task C"
2014-04-01 23:36:18,944 - web2py.app.myapp - DEBUG - new task report: COMPLETED
2014-04-01 23:36:18,944 - web2py.app.myapp - DEBUG - result: "Done: Task A"
2014-04-01 23:36:19,719 - web2py.app.myapp - DEBUG - new task report: COMPLETED
2014-04-01 23:36:19,719 - web2py.app.myapp - DEBUG - result: "Done: Task C"
2014-04-01 23:36:20,486 - web2py.app.myapp - DEBUG - new task report: COMPLETED
2014-04-01 23:36:20,486 - web2py.app.myapp - DEBUG - result: "Done: Task A"
2014-04-01 23:36:21,260 - web2py.app.myapp - DEBUG - new task report: COMPLETED
2014-04-01 23:36:21,260 - web2py.app.myapp - DEBUG - result: "Done: Task B"
2014-04-01 23:36:22,045 - web2py.app.myapp - DEBUG - new task report: COMPLETED
2014-04-01 23:36:22,045 - web2py.app.myapp - DEBUG - result: "Done: Task C"
2014-04-01 23:36:22,819 - web2py.app.myapp - DEBUG - new task report: COMPLETED
2014-04-01 23:36:22,819 - web2py.app.myapp - DEBUG - result: "Done: Task A"
2014-04-01 23:36:23,598 - web2py.app.myapp - DEBUG - new task report: COMPLETED
2014-04-01 23:36:23,598 - web2py.app.myapp - DEBUG - result: "Done: Task B"
2014-04-01 23:36:24,372 - web2py.app.myapp - DEBUG - new task report: COMPLETED
I wasn't sure what to make of it. Looks like the tasks are
running at a pace much higher than what I expected.
Initially, I suspected that the heartbeat -20seconds -
determines the frequency of the tasks. And then I re-read
the section on the task's period-repeat combination. Now am
a bit lost.
I need to run one of the tasks in a once in 24hours cycle.
So intend to use the period/repeat combination for that
task. The other tasks need to run once every minute or so.
My intention is to ensure that the number of times the tasks
hit the db is not too frequent.
More importantly can someone help me understand what the
timing in this log means, and why the tasks are running at
this high a frequency?
Thank you.
Kiran
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.
|