librelist archives

« back to archive

Flask background Job support

Flask background Job support

From:
Sojin
Date:
2011-09-24 @ 10:29
Hi Friends,

We are considering Flask for one of our next mid-sized project, seems Flask
provide built-in/extension support for most of our project requirements, one
exception though :-
Is there a possibility to run a background job from Flask (to be specific,
we just want to send a confirmation mail upon successful sign-up and want
this to be done in background.)

Cheers
Soj

Re: [flask] Flask background Job support

From:
Alex K
Date:
2011-09-24 @ 10:35
Flask-Celery?


On Sat, Sep 24, 2011 at 2:29 PM, Sojin <sojin.v@gmail.com> wrote:

> Hi Friends,
>
> We are considering Flask for one of our next mid-sized project, seems Flask
> provide built-in/extension support for most of our project requirements, one
> exception though :-
> Is there a possibility to run a background job from Flask (to be specific,
> we just want to send a confirmation mail upon successful sign-up and want
> this to be done in background.)
>
> Cheers
> Soj
>

Re: [flask] Flask background Job support

From:
Alex
Date:
2011-09-24 @ 13:37
Celery could be an option but if you want a KISS approach I suggest to
use Flask-Script [*]  and cron.

Alex

[*] http://packages.python.org/Flask-Script/

On Sat, Sep 24, 2011 at 12:35 PM, Alex K <lestatcheb@googlemail.com> wrote:
> Flask-Celery?
>
> On Sat, Sep 24, 2011 at 2:29 PM, Sojin <sojin.v@gmail.com> wrote:
>>
>> Hi Friends,
>>
>> We are considering Flask for one of our next mid-sized project, seems
>> Flask provide built-in/extension support for most of our project
>> requirements, one exception though :-
>> Is there a possibility to run a background job from Flask (to be specific,
>> we just want to send a confirmation mail upon successful sign-up and want
>> this to be done in background.)
>>
>> Cheers
>> Soj
>
>

Re: [flask] Flask background Job support

From:
Armin Ronacher
Date:
2011-09-24 @ 14:16
Hi,

On 2011-09-24 3:37 PM, Alex wrote:
> Celery could be an option but if you want a KISS approach I suggest to
> use Flask-Script [*]  and cron.
Why not redis?  Redis is amazing for this.


Regards,
Armin

Re: [flask] Flask background Job support

From:
Armin Ronacher
Date:
2011-09-24 @ 19:50
Hi,

To add to the "Why not redis" remark.  Here a dead simple way to use
redis as a queue with Python:

http://flask.pocoo.org/snippets/73/


Regards,
Armin

Re: [flask] Flask background Job support

From:
Cheng-Han Lee
Date:
2011-09-24 @ 20:34
Redis/Beanstalkd will work great as task queues. However, if you'll have to
implement additional job queue logic on top of them (i.e. to what to do when
a job fails, when the system crashes etc.).

On the bright side, celery can use  Redis/Beanstalkd as its task queue, so
you don't have to mess with heavy weight solutions like RabbitMQ or the
likes.

On Sat, Sep 24, 2011 at 12:50 PM, Armin Ronacher <
armin.ronacher@active-4.com> wrote:

> Hi,
>
> To add to the "Why not redis" remark.  Here a dead simple way to use
> redis as a queue with Python:
>
> http://flask.pocoo.org/snippets/73/
>
>
> Regards,
> Armin
>

Re: [flask] Flask background Job support

From:
heww0205
Date:
2011-09-25 @ 00:13
But, Flask-Celery can not use Application Factories, how to solve it?

2011/9/25 Cheng-Han Lee <lee.chenghan@gmail.com>

> Redis/Beanstalkd will work great as task queues. However, if you'll have to
> implement additional job queue logic on top of them (i.e. to what to do when
> a job fails, when the system crashes etc.).
>
> On the bright side, celery can use  Redis/Beanstalkd as its task queue, so
> you don't have to mess with heavy weight solutions like RabbitMQ or the
> likes.
>
>
> On Sat, Sep 24, 2011 at 12:50 PM, Armin Ronacher <
> armin.ronacher@active-4.com> wrote:
>
>> Hi,
>>
>> To add to the "Why not redis" remark.  Here a dead simple way to use
>> redis as a queue with Python:
>>
>> http://flask.pocoo.org/snippets/73/
>>
>>
>> Regards,
>> Armin
>>
>
>

Re: [flask] Flask background Job support

From:
Joe Esposito
Date:
2011-09-25 @ 19:03
Wow, after recently migrating from Celery/RabbitMQ to Beanstalkd (and *
loving* its relative simplicity), I just read over the latest Redis
snippet<http://flask.pocoo.org/snippets/73/> and
it's also quite attractive. It looks like a very decent middle ground, being
both simple to set up and quite natural to use in Python. Redis also seems
pretty lightweight. Not as much as Beanstalkd, but looks like it's worth the
tradeoff.

Thanks for sharing, I'll be playing with Redis today. Also, there's a Redis
Windows port on GitHub <http://github.com/dmajkic/redis> for those looking
for one.

On Sat, Sep 24, 2011 at 8:13 PM, heww0205 <heww0205@gmail.com> wrote:

> But, Flask-Celery can not use Application Factories, how to solve it?
>
>
> 2011/9/25 Cheng-Han Lee <lee.chenghan@gmail.com>
>
>> Redis/Beanstalkd will work great as task queues. However, if you'll have
>> to implement additional job queue logic on top of them (i.e. to what to do
>> when a job fails, when the system crashes etc.).
>>
>> On the bright side, celery can use  Redis/Beanstalkd as its task queue, so
>> you don't have to mess with heavy weight solutions like RabbitMQ or the
>> likes.
>>
>>
>> On Sat, Sep 24, 2011 at 12:50 PM, Armin Ronacher <
>> armin.ronacher@active-4.com> wrote:
>>
>>> Hi,
>>>
>>> To add to the "Why not redis" remark.  Here a dead simple way to use
>>> redis as a queue with Python:
>>>
>>> http://flask.pocoo.org/snippets/73/
>>>
>>>
>>> Regards,
>>> Armin
>>>
>>
>>
>

Re: [flask] Flask background Job support

From:
Joe Esposito
Date:
2011-09-26 @ 03:47
Redis is awesome.

And the Basic Message Queue with Redis
snippet<http://flask.pocoo.org/snippets/73/>is very helpful.
There's a bug though. This line:

del session[key]


should be:

del session['add_result_key']


And it works perfectly.

On Sun, Sep 25, 2011 at 3:03 PM, Joe Esposito <espo58@gmail.com> wrote:

> Wow, after recently migrating from Celery/RabbitMQ to Beanstalkd (and *
> loving* its relative simplicity), I just read over the latest Redis
> snippet <http://flask.pocoo.org/snippets/73/> and it's also quite
> attractive. It looks like a very decent middle ground, being both simple to
> set up and quite natural to use in Python. Redis also seems pretty
> lightweight. Not as much as Beanstalkd, but looks like it's worth the
> tradeoff.
>
> Thanks for sharing, I'll be playing with Redis today. Also, there's a Redis
> Windows port on GitHub <http://github.com/dmajkic/redis> for those looking
> for one.
>
> On Sat, Sep 24, 2011 at 8:13 PM, heww0205 <heww0205@gmail.com> wrote:
>
>> But, Flask-Celery can not use Application Factories, how to solve it?
>>
>>
>> 2011/9/25 Cheng-Han Lee <lee.chenghan@gmail.com>
>>
>>> Redis/Beanstalkd will work great as task queues. However, if you'll have
>>> to implement additional job queue logic on top of them (i.e. to what to do
>>> when a job fails, when the system crashes etc.).
>>>
>>> On the bright side, celery can use  Redis/Beanstalkd as its task queue,
>>> so you don't have to mess with heavy weight solutions like RabbitMQ or the
>>> likes.
>>>
>>>
>>> On Sat, Sep 24, 2011 at 12:50 PM, Armin Ronacher <
>>> armin.ronacher@active-4.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> To add to the "Why not redis" remark.  Here a dead simple way to use
>>>> redis as a queue with Python:
>>>>
>>>> http://flask.pocoo.org/snippets/73/
>>>>
>>>>
>>>> Regards,
>>>> Armin
>>>>
>>>
>>>
>>
>

Re: [flask] Flask background Job support

From:
Sojin
Date:
2011-09-29 @ 23:53
Thanks for options.

On Mon, Sep 26, 2011 at 11:47 AM, Joe Esposito <espo58@gmail.com> wrote:

> Redis is awesome.
>
> And the Basic Message Queue with Redis 
snippet<http://flask.pocoo.org/snippets/73/>is very helpful.
> There's a bug though. This line:
>
> del session[key]
>
>
> should be:
>
> del session['add_result_key']
>
>
> And it works perfectly.
>
> On Sun, Sep 25, 2011 at 3:03 PM, Joe Esposito <espo58@gmail.com> wrote:
>
>> Wow, after recently migrating from Celery/RabbitMQ to Beanstalkd (and *
>> loving* its relative simplicity), I just read over the latest Redis
>> snippet <http://flask.pocoo.org/snippets/73/> and it's also quite
>> attractive. It looks like a very decent middle ground, being both simple to
>> set up and quite natural to use in Python. Redis also seems pretty
>> lightweight. Not as much as Beanstalkd, but looks like it's worth the
>> tradeoff.
>>
>> Thanks for sharing, I'll be playing with Redis today. Also, there's a
>> Redis Windows port on GitHub <http://github.com/dmajkic/redis> for those
>> looking for one.
>>
>> On Sat, Sep 24, 2011 at 8:13 PM, heww0205 <heww0205@gmail.com> wrote:
>>
>>> But, Flask-Celery can not use Application Factories, how to solve it?
>>>
>>>
>>> 2011/9/25 Cheng-Han Lee <lee.chenghan@gmail.com>
>>>
>>>> Redis/Beanstalkd will work great as task queues. However, if you'll have
>>>> to implement additional job queue logic on top of them (i.e. to what to do
>>>> when a job fails, when the system crashes etc.).
>>>>
>>>> On the bright side, celery can use  Redis/Beanstalkd as its task queue,
>>>> so you don't have to mess with heavy weight solutions like RabbitMQ or the
>>>> likes.
>>>>
>>>>
>>>> On Sat, Sep 24, 2011 at 12:50 PM, Armin Ronacher <
>>>> armin.ronacher@active-4.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> To add to the "Why not redis" remark.  Here a dead simple way to use
>>>>> redis as a queue with Python:
>>>>>
>>>>> http://flask.pocoo.org/snippets/73/
>>>>>
>>>>>
>>>>> Regards,
>>>>> Armin
>>>>>
>>>>
>>>>
>>>
>>
>

Re: [flask] Flask background Job support

From:
Steven Kryskalla
Date:
2011-09-24 @ 18:24
+1 for redis and pyres: https://github.com/binarydud/pyres

Re: [flask] Flask background Job support

From:
kracekumar ramaraju
Date:
2011-09-24 @ 14:58
+1 for redis .

Re: [flask] Flask background Job support

From:
Joe Esposito
Date:
2011-09-24 @ 15:23
Beanstalkd (and beanstalkc for Python) is another super-simple solution I've
come across.

On Sat, Sep 24, 2011 at 10:58 AM, kracekumar ramaraju <
kracethekingmaker@gmail.com> wrote:

> +1 for redis .