I started to write a post saying "ok - can't start a new thread - so how can I run a background task?" and then I really struggled to find an example that couldn't be solved some other way.
The only example I came up with was a major processing task, maybe some major calculation or db search/analysis, that is kicked off by a request, runs in background and sets an indicator when completed. 1) what other background tasks do people envisage? 2) how should you do it in web2py? On Oct 26, 4:52 pm, mdipierro <[EMAIL PROTECTED]> wrote: > Not sure I understand the question. > Let's say you create a "test" application with a simple "default.py" > controller: > > def index(): return "hello world" > > This is already a multithreaded application. Every time an http > request for "http://localhost:8000/test/default/index" arrives, a new > thread is created by the web2py web server. > It is the web server that creates threads (at every request) and kills > them (when they take too long). The web server is often even smarter > than that and reuses existing threads. > > threads created this way can share information using one of the > following mechanisms: > 1) database (db=SQLDB(....)) > 2) cache (cache.disk, cache.ram, cache.memcache) > 3) session (session.myvariable=3) > 4) filesystem (open(os.path.join(request.folder,'private/ > myfile.txt),'w').write('hello')) > > You should not create threads manually by using thread and threading > modules. > > Massimo > > On Oct 26, 11:24 am, tommy <[EMAIL PROTECTED]> wrote: > > > I tried to run some tasks every certain minutes in the background for > > my WEB2PY application. I created another thread, but my web page > > screen was stuck there for ever. Can someone tell me how to write > > multthreaded GUI application in web2py? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---