I have read the book. But it doesn't state where to actually write the code
snipes given. Both, the book and google is very fancy about explaining how
to start a scheduler by the console. But i literally do not see how i can
start the scheduler.
If i write this into the controller,
scheduler.queue_task(
task_1,
pargs=[],
pvars={},
start_time=now, #datetime
stop_time = None, #datetime
timeout = 60, #seconds
prevent_drift=False,
period=60, #seconds
immediate=False,
repeats = 1
)
it atleast creates the tables and populates one of the tables with an set
of records(scheduler_task) and does so whenever i call the function. But it
only works as long as the function is in the same controller. if the
function is in the modules, an error is returned. When i put this into the
model, it creates the tabels but does not populate any of them.
some possible reasons why it does not run i have made up are:
-i'm queueing tasks but not creating a worker to work on them (but the book
doesnt state anywhere to create a worker. I think therefore this cant be
the solution)
-the function isn't defined proper and the worker does not know what to do.
Am Mittwoch, 24. Februar 2016 00:11:47 UTC+1 schrieb Lucas Schreiber:
>
> Hi there,
> while trying to understand how to use the scheduler, i found this post:
> https://groups.google.com/forum/#!topic/web2py/VCPZmSc0vLc
>
> In the Post, this code is writen:
> db.scheduler_task.insert(function_name='task1',
> task_name='task1',
> stop_time = now + timedelta(days=90000),
> repeats=0,
> period=10)
> g
> Where do i put this code? in the model? I think this was partly answered
> in the post, but i dont understand it. can someone explain this to me?
>
> Also, is there a way to let a scheduler run at a time writen in a db once
> and then rest until the next time occurs? or is a permanent run every few
> seconds checking for certain criteria the better solution?
>
> And just to see if I understood this so far correctly:
> the scheduler function is basically a function I write into the model,
> offering everything a "normal" function offers, exectued at times i
> determine?
>
> Kind regards
> And
>
--
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.