HI Dave, How do I make hcstar as a task. What is wrong in my code?
Thanks, Suhas On Fri, May 24, 2019 at 1:25 PM Dave S <snidely....@gmail.com> wrote: > > > On Friday, May 24, 2019 at 12:05:31 AM UTC-7, Suhas Jadhav wrote: >> >> Hi, >> >> I have following code >> >> def fun1: >> do something >> returns locals() >> >> I have below code in scheduler.py >> >> def hcstar(): >> LOAD('monitoring',' fun1') >> >> from gluon.scheduler import Scheduler >> scheduler2 = Scheduler(db,tasks=dict(hcstar=hcstar,fun1=func2)) >> > > From your defuns, neither hcstar nor fun1 appear to be task-like. Tasks > do not talk directly to a client ("the user"); instead they perform work on > files or database entries or some such. The scheduler will record their > "stdout" (print statements, etc) and if the task returns a string or > boolean. If you're just trying to get familiar with setting up tasks, a > function that does a print("Hello from taskA") and returns a True will work > nicely. > > The other part of the equation is that you have to have a thread or job > running somewhere to launch the workers. That's the job of the -K command > line parameter. > > > >> I have scheduled the task to run every 5 min. >> I can see the task is changing the status as ASSIGNED-->QUEUED >> But I do not see the record being inserted into db.scheduler_run >> <http://10.184.96.105/bot/appadmin/select/db?query=db.scheduler_run.id%3E0> >> >> Also function fun1 is not being called. >> >> Can anybody help. >> >> >> >> -- >> Thanks, >> Suhas >> > > > Good luck! > > Dave > /dps > > > -- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/33d86058-a557-49c6-9f7a-60cda9cdc030%40googlegroups.com > <https://groups.google.com/d/msgid/web2py/33d86058-a557-49c6-9f7a-60cda9cdc030%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Thanks, Suhas -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CAM9jc1Bqs5-TEwjtQUNPMenGvkHZLoDA_NZ3NrNktJsStX1BRQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.