Hi ,


I noticed an unexpected behaviour when running two scheduler processes.


The situation is this :


A db  with a table  like :


db.define_table('taba',
 Field('fa', unique=True, requires = IS_NOT_IN_DB(db,'taba.fa')), 
 Field('fb'))



a task (same function different args) distributed to the processes which 
contains a :


ret = db.taba.validate_and_insert(fa='something', fb='somethingelse')


this generates an exception like so :


File "/opt/web2py/gluon/packages/dal/pydal/objects.py", line 737, in 
validate_and_insert 
 response.id = self.insert(**new_fields) 
 File "/opt/web2py/gluon/packages/dal/pydal/objects.py", line 712, in 
insert 
 ret = self._db._adapter.insert(self, self._listify(fields)) 
 File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 739, in 
insert 

 raise e 
IntegrityError: duplicate key value violates unique constraint "taba_fa_key" 

DETAIL: Key (fa)=(something) already exists. 



and task fails


This doesn't happen when running a single scheduler process so I guess the 
two scheduler processes collide(….they try to write the same value to the 
db at the same time……)


how do I fix this ? Why can't the two processes cooperate ? Am I limited to 
running a single sched process ?

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

Reply via email to