[web2py] Re: 50x performance improvement for web2py in TechEmpower Web Framework Benchmarks

2016-11-20 Thread Mark Graves
This is great news! Thank you for working on this, all of you.

Any ability to check out the errors?

Would love to know what that was.

On Saturday, November 19, 2016 at 2:16:18 PM UTC-6, Massimo Di Pierro wrote:
>
> Fantastic! Thank you Anthony, Michele, Simone, Richard, Paolo, Giovanni 
> and everybody who made this happen!
>
> On Thursday, 17 November 2016 19:17:48 UTC-6, Anthony wrote:
>>
>> TechEmpower just released Round 13 of its Web Framework Benchmarks. In 
>> previous rounds, web2py did very poorly because the original app that was 
>> submitted was using some inefficient code and was deployed with the 
>> development server rather than a production server. Here is a link to 
>> results from the previous round comparing web2py with Django and Flask: 
>> Round 
>> 12 
>> 
>> .
>>
>> I submitted a re-worked version of the web2py app for the new round. 
>> Although web2py is still slower than the other frameworks, its performance 
>> is now within the same order of magnitude as Django and Flask, with about a 
>> 5000% improvement from Round 12 relative to those frameworks. Notably, 
>> web2py is actually *faster *than Django and Flask on the "Multiple 
>> queries" task. Here is a link to the new results (again, comparing with 
>> Django and Flask): Round 13 
>> 
>>
>> Notice, in addition to a standard web2py setup, there is also a version 
>> labeled "web2py-optimized," which uses a few tricks to speed things up 
>> (e.g., disabling sessions and serving responses directly from model files).
>>
>> Note, in the bar chart, web2py's performance on the "Data updates" task 
>> looks particularly low. However, the bar chart reports only the requests 
>> with 20 updates -- web2py is more competitive with 10 updates, and superior 
>> with 5 updates (see the full data table 
>> ).
>>  
>> I'm not sure what happened with the 20-update requests (looks like there 
>> were lots of server errors generated) -- this was not a problem when 
>> testing on my VM (and on all the other tasks, performance was consistently 
>> *lower* on my VM than we see in the final public benchmarks).
>>
>> The web2py code can be found at 
>> https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/frameworks/Python/web2py
>> .
>>
>> You can see the results for all frameworks tested at 
>> https://www.techempower.com/benchmarks/.
>>
>> Anthony
>>
>

-- 
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.


Re: [web2py] scheduling multiple tasks

2016-11-20 Thread Nico de Groot
Hi Vid,

Two remarks at first sight.

In save_outs you initialize the variable now. But you queue the task using
start_now. But the task is inserted, maybe just copy paste error in your
post...

Is the function readOutFile working? Can you show It? It seems it gets
stuck when called the second time. I would suggest to step through the code
using the debugger, or use print statement to pinpoint the timeout.

Nico

Op za 19 nov. 2016 om 05:41 schreef Vid Ogris 

> SO the problem continues.
>
> The task was running  and was completed for some dummy code.
>
> Now i have to go trough a folder, read a file and update file content to
> database.
>
> The task always times out and there are two files that need to be updated,
> non of them are. The code is executed, but there is no db update. Also it
> seems for loop is not completed. For only one file db._lastsql is printed
> in db. The statement in scheduler table is ok and if i run it it inserts
> data into db. Any suggestions?
>
> My code
>
> in scheduler.py
>
> def saveIdOut():
> try:
> #demo koda
> #poberem statuse
> db_status = db(db.scripts.sc_status == 
> 11).select(db.scripts.id).as_list()
> #ggrem v mapo in pogledam katere skripte ki imajo status 11 se 
> dejansko izvajajo
> for rec in db_status:
> scriptId = rec["id"]
> outPath  = os.path.join(request.folder, 'engine', 'e1', 
> str(scriptId) + '.out')
> #preverim če obstaja datoteka
> if os.path.isfile(outPath):
> #če obstaja jo shranim v sc_engine_output
> #sparsamo out datoteko da jo lahko damo v tabelo result
> out = readOutFile(str(scriptId))
> #Vnesemo podatke v tabelo script
> db(db.scripts.id == scriptId).update(sc_engine_output = out)
> print db._lastsql
>
> print "out datoteka za scripto %s, arhivirana" % 
> (str(scriptId))
>
> db.commit()
> return dict(status = 1)
>
> except Exception, e:
> exc_type, exc_obj, exc_tb = sys.exc_info()
> fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
> print(exc_type, fname, exc_tb.tb_lineno)
> print e.__doc__
> print e.message
> return dict(status = 666)
>
>
> in my controler
>
> def save_outs():
>
>
> """
> for running scheduler
> python web2py.py --nogui --no-banner -K woshiweb -D 0
>
> 1 hour = 3600 seconds # for period
> 10 minutes = 600 seconds # for timeout
> """
>
> import datetime
> now = datetime.datetime.now()
>
>
> start_now = datetime.datetime.now()
>
> stop_time_now = (start_now + datetime.timedelta(days = 1))
>
> scheduler.queue_task(saveIdOut, start_time = start_now,
>
>
>next_run_time = start_now, stop_time = stop_time_now,
>
>repeats = 0, retry_failed = 2, period = 30, timeout = 15)
>
> print "Funkcija za arhiviranje outov AKTIVIRANA"
> print "Glej scheduler tabele v postgresu"
> session.flash = T("Task save_outs Queued")
> redirect(URL('index.html'))
>
>
> 2016-11-16 2:32 GMT+08:00 Dave S :
>
>
>
> On Tuesday, November 15, 2016 at 2:14:21 AM UTC-8, Yebach wrote:
>
> Thank you guys. I finally made it. I did not quite understand the whole
> scheduler process but i am now getting there.
>
> Thank you again
>
>
> Congratulations!  It sometimes takes a while to get the right mental
> images, doesn't it?
>
> /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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/FK1ygjNNjDU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
> Lep pozdrav
>
> Vid Ogris
>
>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/FK1ygjNNjDU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 

Re: [web2py] web2py react-python

2016-11-20 Thread Mark Graves
Hey Jose,

I can't necessarily tell you about react-python as I haven't used it.

I have however had interest in maintaining the ability to server side
render with the same templates as I use on a fully client side application.

I'd love to hear some input on this, but my thoughts are that it allows you
to maintain separation of concern, while leveraging the toolchain for both
languages.

On Sun, Nov 20, 2016 at 11:38 AM, José Luis Redrejo 
wrote:

> I must confess my ignorance: Having read and played with react, and being
> a long time web2py user, I don't get the point of rendering react in the
> server from python, connected with a node application. I have made react
> applications running in the view and using json to communicate with the
> python controller, but react was always in the view and python in the
> controller.
> Can anybody tell me one use case or explain when could this pyhon-react
> setup make sense?
>
> Thanks
> José L.
>
> 2016-11-20 10:25 GMT+01:00 Mark Graves :
>
>> Hey everyone,
>>
>> I recently stumbled across this:
>>
>> https://github.com/markfinger/python-react/issues/70#issueco
>> mment-254396083
>>
>> Just thought I'd share for anyone who was looking for something similar
>>
>> -Mark
>>
>> --
>> 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.
>>
>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/GwaHrT4Dqxg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.


[web2py] Found a typo in the docs in auth

2016-11-20 Thread António Ramos
If the visitor is not *logger* in, and calls a function that requires
authentication, the user is redirected to auth.settings.login_url which
defaults to URL('default','user/login'). One can replace this behavior by
redefining:

logger should be logged   ???

regards
António

-- 
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.


Re: [web2py] Re: DAL with db2 on ISeries/OS400 table names converted to AUTH_0000x

2016-11-20 Thread António Ramos
Never tried after this issue. I will let you know shortly this month.
regards

2016-11-14 14:43 GMT+00:00 Jim S :

> Also, you could create an alias for those tables using the longer names.
>
> http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/
> sqlp/rbafycreatingalias.htm
>
> create alias library/auth_membership for library/auth_1
> create alias library/auth_permissions for library/auth_2
>
> Just curious, are you having issues with field names too?
>
> -Jim
>
>
> On Saturday, November 12, 2016 at 4:01:04 PM UTC-6, Ramos wrote:
>>
>> great
>> thank you and next time i promise to read the docs ;)
>>
>> António
>>
>> 2016-11-12 5:23 GMT+00:00 Massimo Di Pierro :
>>
>>> You can use
>>>
>>> auth.settings.update(
>>> table_user_name='auth_user',
>>> table_group_name='auth_group',
>>> table_membership_name='auth_membership',
>>> table_permission_name='auth_permission',
>>> table_event_name='auth_event',
>>> table_cas_name='auth_cas',
>>> table_token_name='auth_token')
>>>
>>> before
>>>
>>> auth.define_tables()
>>>
>>> and pick any name you want.
>>>
>>>
>>> On Tuesday, 8 November 2016 11:30:47 UTC-6, Ramos wrote:

 Hello just found that auth_membership and auth_permissions are created
 as
 AUTH_1 and AUTH_2

 Those who know a litle of working with AS400/db2 know that table names
 are max 10 char long.

 So i think we have a problem...

 Regards
 António

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

-- 
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.


[web2py] Re: what is in the cache ?

2016-11-20 Thread Niphlod
goes to redis, obviously! and redis usually stores it into ram (although it 
usually saves a copy to the disk, which is configurable, but just to not 
make it totally volatile between restarts of redis)

On Friday, November 18, 2016 at 12:21:05 PM UTC+1, Pierre wrote:
>
> Yes I improved my understanding of the cache system since the last 
> message. now writing a component to make sure i can integrate this 
> thing..
>
> where does *cache.redis* goes : ram or disk ?
>
> thanks
>

-- 
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.


[web2py] Re: Processing taking a long time in web2py?

2016-11-20 Thread Niphlod
hiding behind auth doesn't get you protected by DDoS. 
opening a process inside a web2py app vs pure python depends on you 
comparing oranges to apples. web2py env with the default webserver is a 
threaded env, your pure python process probably isn't.


On Friday, November 18, 2016 at 8:34:46 AM UTC+1, Si An wrote:
>
> I'm asking why opening a process in a python script takes much less time 
> than opening the same python code/process in a web2py application.
>
> Also yes I will consider your second point but I think I will hide it 
> behind authentication
>
> On Thursday, 17 November 2016 22:53:50 UTC, Niphlod wrote:
>>
>> well... you're asking why opening a process in python rather than doing 
>> it directly takes more time. no wonders there: of course it takes more 
>> time! Especially if your process writes lots to stdout/stderr that python 
>> needs to collect.
>>
>> BTW: never ever ever run ANY external process from the webserver: you 
>> could easily be DDoSed AND you incur in lots of issues (random timeouts, 
>> memory issues, leaks, and aforementioned slowness).
>>
>

-- 
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.


Re: [web2py] web2py react-python

2016-11-20 Thread José Luis Redrejo
I must confess my ignorance: Having read and played with react, and being a
long time web2py user, I don't get the point of rendering react in the
server from python, connected with a node application. I have made react
applications running in the view and using json to communicate with the
python controller, but react was always in the view and python in the
controller.
Can anybody tell me one use case or explain when could this pyhon-react
setup make sense?

Thanks
José L.

2016-11-20 10:25 GMT+01:00 Mark Graves :

> Hey everyone,
>
> I recently stumbled across this:
>
> https://github.com/markfinger/python-react/issues/70#
> issuecomment-254396083
>
> Just thought I'd share for anyone who was looking for something similar
>
> -Mark
>
> --
> 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.
>

-- 
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.


Re: [web2py] Re: Graph Model (proposal to contribute)

2016-11-20 Thread Andrew Willimott
Thanks Donald,  I'll do another round of improvements and then create a PR.  it 
does need to handle larger models better and I'll improve  the code layout too. 
 I'm also learning the d4 differences and there are a lot of future options 
with using d3.

 web2py with a d3 interactive front end is a good topic.  Interested to  know 
more as I'm working on this too.

-- 
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.


Re: [web2py] 'str' object has no attribute 'year'

2016-11-20 Thread 'Annet' via web2py-users
Hi Richard,

Thanks for your reply, you are right, setting default to None solves the 
problem.


Kind regards,

Annet

-- 
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.


Re: [web2py] lastName, firstName in form

2016-11-20 Thread 'Annet' via web2py-users
Hi Anthony and Richard,

Thank you both for your replies

It's probably a good idea to strip any leading/trailing whitespace before 
> the names are ever inserted in the database.
>

To solve the issue I use .strip()


Kind regards,

Annet 

-- 
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.


[web2py] Re: Check to establish whether or not a record exists

2016-11-20 Thread Meinolf
Hi Massimo

Just came across this post and got a bit alarmed, so when i check if a 
record exists i don't have to use the usual '==' but instead '=' ?

On Monday, October 10, 2011 at 3:55:27 PM UTC+2, Massimo Di Pierro wrote:
>
> row = db.postcode_cache(postcode=postcode) 
> if not row: 
> db.postcode_cache.insert(postcode=postcode,nearset=nearest) 
> elif not row.nearest: row.update_record(nearset=nearest) 
> else: pass # do nothing 
>
> On Oct 10, 8:22 am, Chris Rowson  wrote: 
> > Hi list, 
> > 
> > I have a database table which looks like this: 
> > 
> > postcode_cache 
> >  
> > postcode (UNIQUE) 
> > lat 
> > lon 
> > nearest 
> > 
> > I want to test first whether or not a record exists for 'postcode' and 
> > if a record does exist, I want to check whether the 'nearest' field 
> > contains any data. 
> > 
> > I've tried this: 
> > 
> > if db(db.postcode_cache.postcode==postcode).select().first()==None: 
> > create_a_new_postcode_record() 
> > 
> > elif 
> db(db.postcode_cache.postcode==postcode).select(db.postcode_cache.nearest)= 
> =None: 
> > populate_the_nearest_field() 
> > 
> > else: 
> > nothing_to_do() 
> > 
> > And while the check to establish whether or not a record exists seems 
> > to work, the check to see whether or not the 'nearest' field within 
> > the record is populated doesn't seem to work. 
> > 
> > Can anyone tell me what I'm doing wrong please? 
> > 
> > Thank you, 
> > 
> > Chris

-- 
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.


[web2py] web2py react-python

2016-11-20 Thread Mark Graves
Hey everyone,

I recently stumbled across this:

https://github.com/markfinger/python-react/issues/70#issuecomment-254396083

Just thought I'd share for anyone who was looking for something similar

-Mark

-- 
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.