On 4 Lis, 19:05, John Anderson <[email protected]> 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.

I see at least 3 solutions here:
1. Move updating e-mail address to task.
2. Commit transaction before sending task.
3. Wait in task some time and check in database if new e-mail was set.

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

I would add column 'last_update' in your table. Then in task check if
this value is modified.


>
> But since its an update there is *some* data there, so the task will be
> able to complete just fine but its invalid data.
>
>
>
>
>
>
>
> On Fri, Nov 4, 2011 at 12:56 PM, Łukasz Oleś <[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 <[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ś <[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 <[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 [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.
>
> > --
> > 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.

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

Reply via email to