If you don't want your user to click somewhere every n seconds to see it, 
the only two ways are ajax (polling at n seconds interval the status) or 
websocket.

The easier way is monitoring with ajax calls.

You can find complete examples online. I'm sure that there are a lot of 
implementations, but I made an app using extensively the scheduler (and 
tested it throughly). You can find the code on 
https://github.com/niphlod/w2p_tvseries/ .
I'm using the periodicalupdater jquery plugin to ease off the cruft for 
"start monitoring, poll every n seconds, stop when done" thingy. 
NB: it could be a lot simpler

https://github.com/niphlod/w2p_tvseries/blob/master/views/manage/add.html 
(view)
 and 
https://github.com/niphlod/w2p_tvseries/blob/master/controllers/manage.py 
(controller)

The called action performs the task queueing and the monitoring all in one 
function.

Basically on the first click the task gets enqueued and a task_id is saved 
on the button itself (a neat jquery feature). The task_id is then sent on 
the subsequent request as an argument, the controller see it and instead of 
enqueuing another task it monitors the status.
A message is passed back, and it replaces the button content (from "add 
series" to "working on it...").
Finally, if task is completed, a command is passed back to stop the 
"refreshing" of the button.
If you don't understand how this works feel free to ask.

BTW: the trunk scheduler will be the one included when web2py 2.0 will be 
released. Feel free to use it, but for monitoring purposes there should be 
no changes (i.e. watching for the scheduler_run record status or the 
scheduler_task status, if you're not using repeating tasks)



On Tuesday, July 24, 2012 5:07:22 PM UTC+2, Tim Richardson wrote:
>
> I'm using the 'experimental' scheduler with 1.99.7 . I know there are 
> posts encouraging us to try the development version, but I'm just learning 
> web2py and I'm trying to keep things as controlled as possible. Plus I 
> don't know when the development version becomes stable. 
>
> I can send a job to the scheduler. I'm using it because I have some tasks 
> that could take a few minutes to finish. What's a recommended way for a 
> user still at their browser to see when a job is complete? Some kind of 
> ajax usage?
>
>
>

-- 



Reply via email to