Thanks, Massimo. I'll try it and report what happens. Cheers, Mike
On Mon, Jan 2, 2012 at 10:38 PM, Massimo Di Pierro < [email protected]> wrote: > I remind you > > web2py/scripts/make_min_web2py.py > > which makes web2py much smaller by eliminating rarely used module that > consume lots of space. > I am not sure about the impact on Ram but the impact on Disk space is > significative. > > Massimo > > On Jan 2, 3:04 pm, Michael Ellis <[email protected]> wrote: > > Found some advice from Massimo in another thread. > > > > After adding > > > > try: > > _junk = db > > except NameError: > > _w2pdir = "/Users/mellis/web2py/" > > sys.path.append(_w2pdir) > > from gluon import DAL > > db = DAL("sqlite://storage.sqlite", > > folder = _w2pdir + "applications/welcome/databases", > > auto_import = True) > > > > to my test script, running it without web2py gets the memory footprint > > down from 25 Mb to 13Mb. That's definitely an improvement. Anyone > > know how to shave it further? It still seems a little high for what > > it's doing. > > > > On Jan 2, 3:01 pm, Michael Ellis <[email protected]> wrote: > > > > > > > > > > > > > > > > > Thanks Ross, that sounds like a good approach. I do something > > > analogous in my app. All my scripts live in the app/modules/ > > > directory. My app is a remote monitoring system running on a Foxconn > > > NetTop under Linux Mint 10. There is a web2py http interface used > > > for installation and configuration, but it's not used in day-to-day > > > operation. > > > The long-running scripts are children of a master script similar to > > > the one I appended to my post except that it has additional code to > > > fork the various child processes which, conveniently, inherit the > > > web2py environment including the model. The child processes write > > > incoming data to the sqlitedb, read from it to compute averaged data > > > that gets sent a server in the cloud, monitor for anomalous > > > conditions and send email alerts, etc. The master script does little > > > more than launch the children, monitor them, and relaunch any that > > > crash. > > > What arguments do you use in your calls to DAL() to read in your > > > model? I just pass 'storage.sqlite' and DAL() knows which app/database > > > directory to use since the app name is passed in the web2py -S > > > invocation. Do you have to do anything special when importing dal to > > > make it work without the web2py shell? > > > Cheers,Mike > > > > > On Jan 2, 1:32 pm, Ross Peoples <[email protected]> wrote: > > > > > > Mike, > > > > > > I haven't done any profiling on it, but I've had a lot of success > using the > > > > multiprocessing library, importing the DAL, and using it directly > without > > > > using the rest of the web2py environment. I usually accomplish this > by > > > > creating a module (not model) and spinning off the other processes > from the > > > > module, as the module will stay running after the initial request > finishes. > > > > > > Ross >

