4. whatever you want, just avoid having large stdout (it's a general issue in python that can't be easily fixed). one thing is avoiding db pressure on the database... that means avoiding tenths of workers with thousands of tasks . Another is queuing a single task per hour.
5. that's perfectly normal. when you don't commit, you don't "persist" changes done in that transaction, but the "trace" of the changes remains: the database happily skips saving your data but doesn't do additional checks to figure out what empty spaces are around. transaction a --> creates a record in the table, gets a new id (let's say 84) transaction b --> creates a record in the table, gets a new id, that is what had transaction a plus one (i.e. 85) transaction b --> creates a record in another table saving the reference to the previously inserted one, meaning "85" gets stored transaction a --> rollback()s transaction b --> saves for your mind-mapped method to work, the database discarding transaction a should also remember to rewrite what transaction b has already written and properly persisted. As you can imagine, it's a no go pretty much for everybody. On Friday, October 28, 2016 at 12:30:34 AM UTC+2, 黄祥 wrote: > > thanks all > 1. got it > 2. already tested it, the problem is, if put all tasks in 1 controller, > when 1 task is failed, then run queue task, another task that have status > is queued will get doubled. > 3. going to wait for the cronlike feature in stable version > > *another question:* > 4. is it best practice to have shell script execute in web2py scheduler? > it is run well but i've seen in this forum many developers talk about avoid > to hit the database as much as possible, because shell script can run by os > (outside of web2py app) > *e.g.* > *static/scripts/backup.sh* > rsync -zavur ~/web2py/applications/test ~/backup/webapp/ > > *models/scheduler.sh* > def backup_app(): > command = "applications/test/static/scripts/backup.sh" > proc = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = > subprocess.PIPE) > output, err = proc.communicate() > test_event.onexecute_event() # insert into db.auth_event > db.commit() > 5. another strange things about db.commit() in scheduler for above code, > when i comment db.commit(), the table auth_event is got nothing, but the id > is jump > *e.g.* > latest id on table auth_event : 10 > execute queue task for backup_app without db.commit, check latest id on > table auth_event : 10 > execute queue task for backup_app with db.commit, check latest id on table > auth_event : 12 > > as you can see the id of auth_event is jump from 10 to 12 (don't have id > 11), it seems (i assume) that when execute without db.commit, it got there > but with no data, not sure what's happen for that case, any idea? > > thanks and best regards, > stifan > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

