On Thursday, June 16, 2016 at 8:52:34 AM UTC-7, Jitun John wrote:
>
> From the main page, once a form is submitted, there is heavy python code 
> doing lots of steps which takes from seconds to minutes to finish.
> It then moves to the next page.
>


This sounds like something that should be done with the scheduler.  Your 
server (apache, nginx) may timeout the request if you try to handle that 
big a job in line.
 

>
> Between the 2 pages, I am trying to see if there can be a indication on 
> the HTML page indicating working in background.
> Something similar to http://www.w3schools.com/howto/howto_css_loader.asp
>
> I tried to show responce.flash, tried to create an intermediary page with 
> the loader code above, but nothing works.
> Once the python code starts to work, html page can only be seen once it is 
> done.
>
> response.flash = DIV('All Good...', BR(), 'Working hard to Parse the Logs... 
> Please Wait...', BR(), 'Check the Console Window for Progress...')
>
> create_all_sqlite_tables(uniq_log_path) ------> time consuming code
> create_mg_db(uniq_log_path)             ------> time consuming code
> redirect(URL('management_summary', args=form.vars.id))
>
>
>
> before the time consuming code kicks in ... we have flash.. but it doest 
> show up..
>
> I tried to redirect to a intermediate URL which had the css_loader page... 
> and added the heavy code there.. but I never see that page as well.
>
> All I would want is to put a loader css on probably the main page as soon 
> as the form is accepted... if possible.
>


There have been several discussions of progress bars here recently.  One 
such thread is
<URL:https://groups.google.com/d/topic/web2py/zgSLxeg7avw/discussion>

That thread references using the scheduler, but doesn't show it ... the 
solutions show simulating progress by just bumping a session value each 
update.  Updates are done using ajax with the browser, so there is some 
javascript on the client side.

Your scheduler task could update the progress value based on which part of 
the computation it is in (or if there's just a big loop chewing on 
mouthfuls of data, do an "if loopindex % 50: 
update_progress_value(loopindex)".

/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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to