On 04.11.11 13:05, John Anderson wrote: > A celery task isn't always about the data... For instance sending a > confirmation e-mail when e-mail address is updated: > > 1. Update e-mail address > > 2. Start celery task to send e-mail to confirm new e-mail address > > If the updating the e-mail address failed, its going to send e-mail to > their current e-mail address, not the one they tried updating to. > > > Another example specific to what i'm doing...  Someone updates the > sessions they are attending at a conference, you want to notify the > event planners and the speakers of the sessions they were/are now > attending.  So you fire off a task to do that... but if it failed to > update that info I don't want to alert everyone that it changed... > because it didn't. > > But since its an update there is *some* data there, so the task will be > able to complete just fine but its invalid data. >
Both examples are related to emails, for that particular case I use pyramid_mailer + tm: they're awesome combined. I'm using celery to perform certain heavy database tasks that depend on modifications on the data. To make sure the data I need has been committed without errors to the database I'm using the ORM event interface (new with sqlalchemy>=0.7 although something similar -mapper extensions- can be found in prior versions). I'm using the 'after_insert', 'after_update' events and firing a celery "apply_async" function to process my routine asynchronously. Seems to be working acceptably well (I haven't put a lot of stress on it yet). Mariano > > On Fri, Nov 4, 2011 at 12:56 PM, Åukasz OleÅ <[1][email protected]> > wrote: > > If transaction is not completed then data is not in database, so I > can't select it. > I really don't see problem here. > > On 28 Paź, 17:25, John Anderson <[2][email protected]> wrote: > > How did you hook up your celery tasks to only execute if the > transaction on > > the request committed? > > > > > > > > > > > > > > > > > On Fri, Oct 28, 2011 at 9:35 AM, Åukasz OleÅ > <[3][email protected]> wrote: > > > Hi, > > > > > I'm using celery with pyramid without any problems. > > > I'm using pyramid_tm module which uses transaction module. > > > > > On 28 Paź, 09:36, John Anderson <[4][email protected]> wrote: > > > > I was wondering if any of you guys have used celery with Pyramid. >  I'm > > > > looking for a way to have my tasks only execute if the db > transaction > > > > commits.  That way any data the task expects is in the db and > the task > > > only > > > > executes if the data is valid. > > > > > -- > > > Åukasz OleÅ > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "pylons-discuss" group. > > > To post to this group, send email to > [5][email protected]. > > > To unsubscribe from this group, send email to > > > [6][email protected]. > > > For more options, visit this group at > > >[7]http://groups.google.com/group/pylons-discuss?hl=en. > -- > You received this message because you are subscribed to the Google > Groups "pylons-discuss" group. > To post to this group, send email to > [8][email protected]. > To unsubscribe from this group, send email to > [9][email protected]. > For more options, visit this group at > [10]http://groups.google.com/group/pylons-discuss?hl=en. > > -- > You received this message because you are subscribed to the Google > Groups "pylons-discuss" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/pylons-discuss?hl=en. > > References > > 1. mailto:[email protected] > 2. mailto:[email protected] > 3. mailto:[email protected] > 4. mailto:[email protected] > 5. mailto:[email protected] > 6. mailto:pylons-discuss%[email protected] > 7. http://groups.google.com/group/pylons-discuss?hl=en > 8. mailto:[email protected] > 9. mailto:pylons-discuss%[email protected] > 10. http://groups.google.com/group/pylons-discuss?hl=en -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
