well....

mysched.queue_task(application_name='yourappname')


BTW: application_name is usually either "appname" or 
"appname/controller_name" (the latter useful in cases where conditional 
models are required an/or the task is defined in the controller rather than 
in a model)



On Wednesday, November 2, 2016 at 9:58:57 PM UTC+1, mweissen wrote:
>
> Thanks, I have tried it, but the scheduler needs an "application_name":
>
> In the module:
>
> db = DAL(....)
> scheduler = Scheduler(db, migrate=False)
> rtn = scheduler.queue_task("mytask")
>
>
> Now the return value of queue_task is
> rtn ==  {'errors': {'application_name': 'Enter a value'}, 'id': None, 
> 'uuid': None}
>
> How can I provide an application_name ?
>
> 2016-11-02 11:58 GMT+01:00 Niphlod <[email protected] <javascript:>>:
>
>> if the scheduler is already defined in the db, just use 
>> Scheduler(the_uri. migrate=False) . there shouldn't be issues with queuing 
>> tasks .
>>
>> On Wednesday, November 2, 2016 at 11:17:00 AM UTC+1, mweissen wrote:
>>>
>>> Thank you, but it did not work, because the module program does not use 
>>> the models.
>>>
>>> More details:
>>>
>>> The module contains a small smtp-server. This program writes incoming 
>>> emails to a table "db.emails".  This part works very well. Now I want to 
>>> start a scheduler action to analyze each email and to do something with 
>>> every email. The scheduler is necessary, because every action with an email 
>>> may consume some time to finish.
>>>
>>>
>>> 2016-11-02 1:05 GMT+01:00 Dave S <[email protected]>:
>>>
>>>>
>>>>
>>>> On Tuesday, November 1, 2016 at 2:42:28 PM UTC-7, mweissen wrote:
>>>>>
>>>>> I want to start a task from a module. (The module contains a small 
>>>>> smtp-server.)
>>>>> I could it with a db.scheduler_task.insert(...), but I want to use 
>>>>> myschedule.queue_task(...)
>>>>>
>>>>> ​What would be the correct way to define "myschedule" ? Something like
>>>>>
>>>>> myschedule = Scheduler(current.db)​
>>>>>
>>>>>
>>>>> ​Regards, Martin​
>>>>>
>>>>
>>>>
>>>> My first thought is that you define myschedule in your model file(s), 
>>>> and then in whatever controller calls your module, add it to current and 
>>>> pass it that way, or make it an argument of your module's function.  I 
>>>> don't see any reason NOT to use queue_task, and inserting directly into 
>>>> the 
>>>> table is subject Change Without Notice.
>>>>
>>>> /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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to