On Friday, May 24, 2019 at 1:39:52 PM UTC-7, Suhas Jadhav wrote:
>
> HI Dave,
>
> How do I make hcstar  as a task. What is wrong in my code?
>
> Thanks,
> Suhas
>
>

The LOAD() helper is meant to be used in a view.  It isn't a useful tool in 
a task.  A task has no client, and no user interface.  Your controllers 
handle the client side, and use a task to handle something "behind the 
curtain", like a long-running computation, or generating reports based on 
recent database entries, or fetching remote resources.  The controller 
function can watch for task completion if the results need to be shown to 
the user.

What are you trying to do with a task?

/dps


What are you  

> On Fri, May 24, 2019 at 1:25 PM Dave S <snide...@gmail.com <javascript:>> 
> 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 web...@googlegroups.com <javascript:>.
>> 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/1351fc5b-94b9-4219-8dec-ca15c654cfd2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to