Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython

Flask-Beanstalk is unavailable in PyPM, because there aren't any builds for it in the package repositories. Click the linked icons to find out why.

 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
0.0.1 Failed View build log
Linux (64-bit)
0.0.1 Failed View build log
 
Links
License
MIT
Dependencies
Lastest release
version 0.0.1 on Jun 22nd, 2013

Utilities for using Beanstalk with Flask

Client

from flask import Flask
from flask_beanstalk import Beanstalk

app = Flask(__name__)
beanstalk = Beanstalk(app)  # or beanstalk.init_app(app)
Configuration
app.config['BEANSTALK_HOST']
app.config['BEANSTALK_PORT']
app.config['BEANSTALK_PARSE_YAML']
app.config['BEANSTALK_CONN_TIMEOUT']

Worker

import gevent
from flask_beanstalk import Worker as _Worker

class Worker(_Worker):
  def run(self, job):
    self._logger.info('Received: %r' % job.body)
    job.delete()

workers = Worker.spawn_workers(10)
try:
  while True:
    gevent.sleep(10000)
except KeyboardInterrupt:
  Worker.stop_workers(workers)

Try it out

Install and run beanstalkd if you haven't done so yet.

git clone https://github.com/marksteve/flask-beanstalk.git
cd flask-beanstalk
mkvirtualenv flask-beanstalk
workon flask-beanstalk
python setup.py develop
python example_worker.py

On another terminal:

workon flask-beanstalk
python example.py

Go to localhost:5000 in your browser to send a job. The worker should be able to accept and process it. Try to send multiple jobs before sending a SIGINT to the worker. Jobs being worked on should be processed first before the worker shuts down.

Subscribe to package updates

Last updated Jun 22nd, 2013

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.