Skip to main content

Several greenlet subclasses

Project description

Several gevent.Greenlet subclasses.

  • Processlet
  • Transparentlet
import bcrypt
import gevent
from lets import Processlet

# bcrypt.hashpw is very heavy cpu-bound task. it can spend a few seconds.
def hash_password(password, salt=bcrypt.gensalt()):
    return bcrypt.hashpw(str(password), salt)

def tictoc(delay=0.1):
    while True:
        print '.'
        gevent.sleep(delay)

gevent.spawn(tictoc)

# Greenlet, tictoc pauses for a few seconds
greenlet = gevent.spawn(hash_password, 'my_password')
hash = greenlet.get()

# Processlet, tictoc never pauses
processlet = Processlet.spawn(hash_password, 'my_password')
hash = processlet.get()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
lets-0.0.8.tar.gz (4.8 kB) Copy SHA256 hash SHA256 Source None Oct 15, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page