Sure, you need to start your celery process after the commits. I usually gather up "post-commit" tasks in some kind of list and then iterate through them after the commit to run them.
On Apr 14, 2014, at 5:45 PM, Jonathan Vanasco <[email protected]> wrote: > I just ran into an issue where it looks like I could have race conditions > using SqlAlchemy and Celery. Wondering if anyone here has some ideas. > > Here's the scenario: > > A1 Process A - Pyramid - Creates SQLalchemy session. > A2 Process A - Pyramid - Creates data > A3 Process A - Pyramid - flushes data > A4 Process A - Pyramid - fires off an async request to Celery > A5 Process A - Pyramid - more operations > A6 Process A - Pyramid - commits. > > B1 Process B - Celery - gets async request > B2 Process B - Celery - creates sqlalchemy session > B3 Process B - Celery - starts pulling data from the database > B4 Process B - Celery - starts writing data to the database > B5 Process B - Celery - Commit > > > The problem I foresee, is that the B series of events could happen between A4 > and A6. By luck, it appears they're not happening until after A6. There's > nothing in my code that should / could be ensuring that. > > Has anyone else dealt with this? > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
