[web2py] Re: Err 24: too many files open
I am not a redis expert and I don't know how web2py handles the interaction with redis, either. However the scenario could be, either you instantiate one or more new connections for request or 'expired' connections are not closed. I am for the former case, could you post few lines where redis is instantiated? Paolo On Thursday, July 25, 2013 8:48:37 AM UTC+2, dederocks wrote: > > Thank you Paolo for the benchmark! > In my case, I start at 107, and at the end of the process the count is at > 672!! nginx on the other hand is stable around 55. > And the culprit is (drums ...): redis! The large majority of the files > opened are the redis port. > Extract from lsof: > uwsgi 2128 www-data 511u IPv4 62305 0t0 TCP > localhost:56632->localhost:6379 (ESTABLISHED) > uwsgi 2128 www-data 512u IPv4 62536 0t0 TCP > localhost:56661->localhost:6379 (ESTABLISHED) > uwsgi 2128 www-data 513u IPv4 62361 0t0 TCP > localhost:56639->localhost:6379 (ESTABLISHED) > uwsgi 2128 www-data 514u IPv4 62377 0t0 TCP > localhost:56641->localhost:6379 (ESTABLISHED) > uwsgi 2128 www-data 515u IPv4 62392 0t0 TCP > localhost:56643->localhost:6379 (ESTABLISHED) > > Does someone know how to fix this? > > Le jeudi 25 juillet 2013 08:28:08 UTC+2, Paolo Valleri a écrit : >> >> dederocks, I've just tried to run lsof -p on a ubuntu server >> running web2py >> In my case, it returns 138 opened files among libraries, sockets and so >> on; the most opened file is /dev/zero, opened 55 times. >> >> Paolo >> >> On Thursday, July 25, 2013 8:18:32 AM UTC+2, dederocks wrote: >>> >>> Thanks a lot for the link. Unfortunately it didn't help. >>> @roberto: the uwsgi process is then indeed eating all the CPU - but I'm >>> not sure it means uwsgi is the culprit, at least at this stage (could be >>> the case earlier though). >>> Is there in linux a way to know who opened which file and when? lsof >>> gives only the process, not the time. >>> >>> Le mercredi 24 juillet 2013 23:56:10 UTC+2, Niphlod a écrit : it's a problem on the layers "at the base" of web2py, such as the os, nginx or uwsgi. http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/ let's see if @roberto (the developer behind uwsgi) passes by with some useful tips too. On Wednesday, July 24, 2013 4:30:51 PM UTC+2, dederocks wrote: > > I'm running web2py on nginx /uwsgi. > And in a sequence implying frequent serveur calls, I eventually get an > error 500 from the server, which is actualy an error 24: too many files > open (see ticket in attachement). > > I checked former reports on this error, but none seems to match this > case: I'm not using rocket, and running the latest web2py stable version. > I checked also on opening files myself, but that is never the case > (e.g. always done by web2py). > I tried to increase the file opened limit (ulimit -SHn 4048), but to > no improvement. > > Any suggestion? > > Thanks in advance, Andre > > > -- --- 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/groups/opt_out.
[web2py] Re: Link to default value for db table field
The devil is in the details. I understand you store pages and some may have a block_footer and some may not. If they do not have a block_footer, how should the footer be determined? What is an index page? I am making a guess: record = db(query).select(db.page).first() default_footer=cache.ram('block_footer',lambda:db(default_query).select().first().block_footer,300) {{block footer}} {{=record.block_footer else default_footer}} {{end}} On Wednesday, 24 July 2013 17:20:48 UTC+2, shapova...@gmail.com wrote: > > Hi! > > Let's say I've following table defined: > db.define_table('page', >Field('is_index', 'boolean'), >Field('title', 'text', default=''), >Field('block_content', 'text', default=''), >Field('block_ad', 'text', default=''), >Field('block_footer', 'text', default=''), >format='%(title)s' > } > > I've inserted several pages (rows) in it. > > What would be the best way for block_footer to have the same value as in > 'index' rows, i.e. like the footer on many (if not all) pages of a web site > stays the same. > > Basically I'm looking for a way to reference index row's block_footer > value in other page's block_footer field leaving a possibility for > customization in case some page would require a different footer. > > > -- --- 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/groups/opt_out.
[web2py] In the form of custom smartgrid
As after a new entry to the table does not move, while still entering one entry? -- --- 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/groups/opt_out.
[web2py] Re: Need Apache help for "uploads" directory
Yes, the unix permissions on the filesystem are correctly set. I can su to www-data and create, edit, read, and destroy all the files and directories I want. But thru Apache -- nada. I think I'll just toss this VM and start over. I'm thinking KVM would be better than VirtualBox for this anyway. I must have screwed up something when I installed Apache for Debian. Sometimes it's just quicker to start over -- especially since i don't have a big investment of time in this VM instance. Thanks. Joe On Wednesday, July 24, 2013 11:22:20 PM UTC-7, Niphlod wrote: > > just ensure that the user running apache has rw permissions on the web2py > root dir, epsecially the uploads one. > > Il giorno giovedì 25 luglio 2013 00:48:12 UTC+2, Joe Barnhart ha scritto: >> >> Well it's entirely possible I don't understand my problem. >> >> Running on my macbook locally everything works like a charm. On the >> "play" deployment server, which uses Apache, the script that deletes files >> after processing fails because it lacks "permission" (according to the >> web2py error log). Also, when uploading the files Apache goes to 100% cpu >> and stays there, consuming RAM until I get tired of watching. Admittedly, >> they are very large files (~200MB) but I don't see why Apache should >> consume >2G of RAM while spinning in some kind of loop. >> >> Everything is set up as in the book and messages here -- I used Debian >> Linux for the play server and used www-data for the user and group, and put >> web2py under /home/www-user/. The website works fine in all other ways, >> but just has issues uploading/downloading files from my web page file >> loader. >> >> I must say this web deployment step is much harder than using web2py to >> create the site! >> >> -- Joe B. >> >> On Wednesday, July 24, 2013 2:58:07 PM UTC-7, Niphlod wrote: >>> >>> there are no special permissions because apache can't serve the uploads >>> directory by itself. Remember that "uploads" is not the same as "static". >>> The uploads are interely managed by web2py. >>> >>> On Wednesday, July 24, 2013 11:51:05 AM UTC+2, Joe Barnhart wrote: So a central part of my website is a repository of files/objects that are added and removed. I've chosen to use the "uploads" folder in my application directory, with additional feature of scattering the files into subdirectories (because I expect a LOT of them). I'm trying the stock apache2 setup from the book but I find it has no provision for permissions on the uipload directory. I copied the setup for the "static" directory and was able to put files in the directory, but I can't delete files from the directory within my site. Has anyone worked out the changes needed to the stock Apache2 setup that accommodates the upload directory? Seems like it would be a nice addition/update to the book setup. Joe B. >>> -- --- 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/groups/opt_out.
[web2py] Re: Appending for validation using jQuery.
It's probably just a typo, but shouldn't there be a semi-colon after the line that is "// WORKING" as a comment? You need to separate javascript lines with semi-colons, except for the last statement in a function. (But even there it doesn't hurt anything if you put one in.) Get Firebug on Firefox and open the "console" pane. It shows you if you have any javascript errors. -- Joe B. On Wednesday, July 24, 2013 10:05:52 PM UTC-7, Prasad Muley wrote: > > Hello All, > I am newbie web2py programmer. I tried to do custom validation > using jQuery but not gettng expected result. Code is as followed: > > *Model-db.py* > > db.define_table('taxpayer', > Field('name'), > Field('married','boolean'), > Field('spouse_name') > ) > # I don't want use IS_NOT_EMPTY() in this table > > *Controller-default.py* > > def taxer(): > grid=SQLFORM.grid(db.taxpayer,user_signature=False) > if request.args(0) in ['edit']: > form=grid.update_form > if form.process().accepted: > response.flash=form.vars > return dict(grid=grid) > > * > * > *View- default/taxer.html* > > {{extend 'layout.html'}} > {{=grid}} > > jQuery(document).ready( function(){ > var flag=0 > jQuery('.web2py_form').submit(function(){ > //Getting value from tracker status > var get_name=jQuery('#taxpayer_name').val() > if(get_name =="") { > if(flag==0) { >//alert("Please Enter valid Name"); WORKING >jQuery("Please Enter > Valid Name").appendTo("#taxpayer_name__label") // WORKING >jQuery("Please Enter > Valid Name").appendTo("#taxpayer_name") // NOT WORKING > flag=1 > } > return false > } > }); > }); > > > Please help me for this. > I want to display error message for 'name' field as IS_NOT_EMPTY() does. > It successfully does for taxpayer_name__label even as well as > taxpayer_name__row but isn't working for taxpayer_name id. > -- --- 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/groups/opt_out.
[web2py] Re: Err 24: too many files open
I found the problem! And the source was (of course) me. The connexion class was defined as follows: class Connexion(object): rCMD = redis.Redis(host='127.0.0.1') def __init__(self): if not self.rCMD.exists('ConsistoPort'): (...) Which is wrong, as I have to do: class Connexion(object): rCMD = None def __init__(self): self.rCMD = redis.Redis(host='127.0.0.1') if not self.rCMD.exists('ConsistoPort'): (...) I appologize for the noise and at the same time thank for the very constructive feedbacks! Le jeudi 25 juillet 2013 09:07:14 UTC+2, Paolo Valleri a écrit : > > I am not a redis expert and I don't know how web2py handles the > interaction with redis, either. > However the scenario could be, either you instantiate one or more new > connections for request or 'expired' connections are not closed. > I am for the former case, could you post few lines where redis is > instantiated? > > Paolo > > On Thursday, July 25, 2013 8:48:37 AM UTC+2, dederocks wrote: >> >> Thank you Paolo for the benchmark! >> In my case, I start at 107, and at the end of the process the count is at >> 672!! nginx on the other hand is stable around 55. >> And the culprit is (drums ...): redis! The large majority of the files >> opened are the redis port. >> Extract from lsof: >> uwsgi 2128 www-data 511u IPv4 62305 0t0 TCP >> localhost:56632->localhost:6379 (ESTABLISHED) >> uwsgi 2128 www-data 512u IPv4 62536 0t0 TCP >> localhost:56661->localhost:6379 (ESTABLISHED) >> uwsgi 2128 www-data 513u IPv4 62361 0t0 TCP >> localhost:56639->localhost:6379 (ESTABLISHED) >> uwsgi 2128 www-data 514u IPv4 62377 0t0 TCP >> localhost:56641->localhost:6379 (ESTABLISHED) >> uwsgi 2128 www-data 515u IPv4 62392 0t0 TCP >> localhost:56643->localhost:6379 (ESTABLISHED) >> >> Does someone know how to fix this? >> >> Le jeudi 25 juillet 2013 08:28:08 UTC+2, Paolo Valleri a écrit : >>> >>> dederocks, I've just tried to run lsof -p on a ubuntu >>> server running web2py >>> In my case, it returns 138 opened files among libraries, sockets and so >>> on; the most opened file is /dev/zero, opened 55 times. >>> >>> Paolo >>> >>> On Thursday, July 25, 2013 8:18:32 AM UTC+2, dederocks wrote: Thanks a lot for the link. Unfortunately it didn't help. @roberto: the uwsgi process is then indeed eating all the CPU - but I'm not sure it means uwsgi is the culprit, at least at this stage (could be the case earlier though). Is there in linux a way to know who opened which file and when? lsof gives only the process, not the time. Le mercredi 24 juillet 2013 23:56:10 UTC+2, Niphlod a écrit : > > it's a problem on the layers "at the base" of web2py, such as the os, > nginx or uwsgi. > http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/ > let's see if @roberto (the developer behind uwsgi) passes by with some > useful tips too. > > On Wednesday, July 24, 2013 4:30:51 PM UTC+2, dederocks wrote: >> >> I'm running web2py on nginx /uwsgi. >> And in a sequence implying frequent serveur calls, I eventually get >> an error 500 from the server, which is actualy an error 24: too many >> files >> open (see ticket in attachement). >> >> I checked former reports on this error, but none seems to match this >> case: I'm not using rocket, and running the latest web2py stable version. >> I checked also on opening files myself, but that is never the case >> (e.g. always done by web2py). >> I tried to increase the file opened limit (ulimit -SHn 4048), but to >> no improvement. >> >> Any suggestion? >> >> Thanks in advance, Andre >> >> >> -- --- 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/groups/opt_out.
[web2py] Re: Err 24: too many files open
Thank you for letting us know. This will be useful to others. On Thursday, 25 July 2013 10:28:07 UTC+2, dederocks wrote: > > I found the problem! > > And the source was (of course) me. > > The connexion class was defined as follows: > > class Connexion(object): > > rCMD = redis.Redis(host='127.0.0.1') > > def __init__(self): > if not self.rCMD.exists('ConsistoPort'): > (...) > > > Which is wrong, as I have to do: > > class Connexion(object): > > rCMD = None > > def __init__(self): > self.rCMD = redis.Redis(host='127.0.0.1') > if not self.rCMD.exists('ConsistoPort'): > (...) > > > I appologize for the noise and at the same time thank for the very > constructive feedbacks! > > Le jeudi 25 juillet 2013 09:07:14 UTC+2, Paolo Valleri a écrit : >> >> I am not a redis expert and I don't know how web2py handles the >> interaction with redis, either. >> However the scenario could be, either you instantiate one or more new >> connections for request or 'expired' connections are not closed. >> I am for the former case, could you post few lines where redis is >> instantiated? >> >> Paolo >> >> On Thursday, July 25, 2013 8:48:37 AM UTC+2, dederocks wrote: >>> >>> Thank you Paolo for the benchmark! >>> In my case, I start at 107, and at the end of the process the count is >>> at 672!! nginx on the other hand is stable around 55. >>> And the culprit is (drums ...): redis! The large majority of the files >>> opened are the redis port. >>> Extract from lsof: >>> uwsgi 2128 www-data 511u IPv4 62305 0t0 TCP >>> localhost:56632->localhost:6379 (ESTABLISHED) >>> uwsgi 2128 www-data 512u IPv4 62536 0t0 TCP >>> localhost:56661->localhost:6379 (ESTABLISHED) >>> uwsgi 2128 www-data 513u IPv4 62361 0t0 TCP >>> localhost:56639->localhost:6379 (ESTABLISHED) >>> uwsgi 2128 www-data 514u IPv4 62377 0t0 TCP >>> localhost:56641->localhost:6379 (ESTABLISHED) >>> uwsgi 2128 www-data 515u IPv4 62392 0t0 TCP >>> localhost:56643->localhost:6379 (ESTABLISHED) >>> >>> Does someone know how to fix this? >>> >>> Le jeudi 25 juillet 2013 08:28:08 UTC+2, Paolo Valleri a écrit : dederocks, I've just tried to run lsof -p on a ubuntu server running web2py In my case, it returns 138 opened files among libraries, sockets and so on; the most opened file is /dev/zero, opened 55 times. Paolo On Thursday, July 25, 2013 8:18:32 AM UTC+2, dederocks wrote: > > Thanks a lot for the link. Unfortunately it didn't help. > @roberto: the uwsgi process is then indeed eating all the CPU - but > I'm not sure it means uwsgi is the culprit, at least at this stage (could > be the case earlier though). > Is there in linux a way to know who opened which file and when? lsof > gives only the process, not the time. > > Le mercredi 24 juillet 2013 23:56:10 UTC+2, Niphlod a écrit : >> >> it's a problem on the layers "at the base" of web2py, such as the os, >> nginx or uwsgi. >> http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/ >> let's see if @roberto (the developer behind uwsgi) passes by with >> some useful tips too. >> >> On Wednesday, July 24, 2013 4:30:51 PM UTC+2, dederocks wrote: >>> >>> I'm running web2py on nginx /uwsgi. >>> And in a sequence implying frequent serveur calls, I eventually get >>> an error 500 from the server, which is actualy an error 24: too many >>> files >>> open (see ticket in attachement). >>> >>> I checked former reports on this error, but none seems to match this >>> case: I'm not using rocket, and running the latest web2py stable >>> version. >>> I checked also on opening files myself, but that is never the case >>> (e.g. always done by web2py). >>> I tried to increase the file opened limit (ulimit -SHn 4048), but to >>> no improvement. >>> >>> Any suggestion? >>> >>> Thanks in advance, Andre >>> >>> >>> -- --- 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/groups/opt_out.
[web2py] Re: Link to default value for db table field
Thanks Massimo, Your guess is right, only all pages have footer, but let's say 90% of them have the same block_footer, and other 10% have original, unique block_footer, so I don't want to copy-paste content of first page with is_index == True, but at the same time leave a possibility to define custom block_footer content for some page. On Thursday, July 25, 2013 10:24:53 AM UTC+3, Massimo Di Pierro wrote: > > The devil is in the details. I understand you store pages and some may > have a block_footer and some may not. If they do not have a block_footer, > how should the footer be determined? What is an index page? > > I am making a guess: > > record = db(query).select(db.page).first() > > default_footer=cache.ram('block_footer',lambda:db(default_query).select().first().block_footer,300) > > {{block footer}} > {{=record.block_footer else default_footer}} > {{end}} > > > > On Wednesday, 24 July 2013 17:20:48 UTC+2, shapova...@gmail.com wrote: >> >> Hi! >> >> Let's say I've following table defined: >> db.define_table('page', >>Field('is_index', 'boolean'), >>Field('title', 'text', default=''), >>Field('block_content', 'text', default=''), >>Field('block_ad', 'text', default=''), >>Field('block_footer', 'text', default=''), >>format='%(title)s' >> } >> >> I've inserted several pages (rows) in it. >> >> What would be the best way for block_footer to have the same value as in >> 'index' rows, i.e. like the footer on many (if not all) pages of a web site >> stays the same. >> >> Basically I'm looking for a way to reference index row's block_footer >> value in other page's block_footer field leaving a possibility for >> customization in case some page would require a different footer. >> >> >> -- --- 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/groups/opt_out.
[web2py] How to show column from 1:N relation in SQLFORM.grid for child table ?
I have a simple 1:N relation (I think its very common scenatio) as you can see below. Now how can I create a query form SQLFORM.grid to show 'customer_person' table but view company_name in 'company' column instead of ID? I tried to put this query to grid 'db_companies.id == db_persons.company ' (inner join), it worked nice but 'show' button from grid viewed the 'customers_company' and not the 'customers_person' table. Is there a way how to accomplish this using e.g. left join? db_companies=db.define_table('customers_company', Field('company_name','string'), Field('city','string',label=T('Město')), ) db.define_table('customers_person', Field('company','reference customers_company', requires= IS_IN_DB(db,"customers_company.id","customers_company.company_name")), Field('firstname','string'), Field('lastname','string'), ) -- --- 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/groups/opt_out.
Re: [web2py] Re: This javascript worked in older version of web2py - not in trunk version.
I did that (again) now and immediately the javascript stopped working as expected. Then I just put back the file jsquery (*/*! jQuery v@1.8.0)* from the older copy of the app and the javascript worked again as expected. Regards Johann On 24 July 2013 18:42, Richard Vézina wrote: > Johann don't forget to update the other files too... > > https://groups.google.com/d/msg/web2py/tVyL7z7WHkw/mce13Vh-k3UJ > > Richard > > > On Wed, Jul 24, 2013 at 4:46 AM, Johann Spies wrote: > >> >> >> On Wednesday, 24 July 2013 09:54:28 UTC+2, Johann Spies wrote: >>> >>> >>> I have not been able to determine the exact course of the problem. >>> >>> >> It seems that static/js/jquery.js is the problem. Replacing the file in >> the working app with the one from the Welcome app, breaks things. >> >> Regards >> Johann >> >> -- >> >> --- >> 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/groups/opt_out. >> >> >> > > -- > > --- > 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/groups/opt_out. > > > -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- 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/groups/opt_out.
[web2py] Left Join on fields other than id
Hi I have the following code RSRecs = db(query).select( db.weekly_data_reporting.supplier_code, db.weekly_data_reporting.supplier_name, db.weekly_data_reporting.item, db.weekly_data_reporting.orderno, db.weekly_data_reporting.usedon, db.weekly_data_reporting.days, db.weekly_data_reporting.status, db.weekly_data_reporting.itemgroup, db.projects.project_name, db.forecasts.ALL, orderby=[db.weekly_data_reporting.project,db.weekly_data_reporting.itemgroup,db.weekly_data_reporting.supplier_name,db.weekly_data_reporting.orderno], left=db.forecasts.on(db.weekly_data_reporting.item==db.forecasts.item), ) All data is returned except that every field in forecasts.item is empty. I have tripple checked and I do have an item in "forecasts.item" that matches "weekly_data_reporting.item". I am using postgres as my database. Can you see anything wrong with my code? -- --- 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/groups/opt_out.
Re: [web2py] Re: Appending for validation using jQuery.
has anybody got my question? On Thu, Jul 25, 2013 at 2:30 PM, Prasad Muley wrote: > Hello Joe, > I made a mistake while pasting. // working isn't there in > updated code. > actual code is > {{extend 'layout.html'}} > {{=form}} > > jQuery(document).ready( function(){ > var flag=0 > jQuery('.web2py_form').submit(function(){ > //Getting value from tracker status > var get_data=jQuery(this).html(); > var get_name=jQuery('#taxpayer_name').val() > if(get_name =="") { > if(flag==0) { > //Following are working > //alert("Please Enter valid Name"); > // jQuery("Please Enter Valid > Name").appendTo("#taxpayer_name__label") > //jQuery("Please Enter Valid > Name").appendTo(".w2p_fw") > jQuery("Please Enter > Name