Alright, so far i am able to create the tables, but nothing runs.
So far i have this:
Model:
database:
dba = DAL(connection)
dba.define_table('test_table',
Field('test_table_id', 'integer'),
Field('test_table_value'))
scheduler:
from gluon.scheduler import Scheduler
scheduler = Scheduler(dba)
controller:
index:
def start():
import datetime
daytime_start = datetime.datetime(2017, 1, 1, 0, 0)
a = 'a'
dba.scheduler_task.insert(function_name='task_1',
task_name='task_1',
stop_time = daytime_start,
repeats=0,
period=10)
return dict(a=a)
def index():
text1 = 'test'
return dict (text1=text1)
module:
test.py:
def task_1():
c= 0
dba.test_table.insert(test_table_id = 1, test_table_value = 'a')
db.commit()
return dict(c=c)
How do i get it startet, e.g. filling the test_table with those values
every n seconds?
Thank you very much for your help so far
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.