Giter Club home page Giter Club logo

gunicorn_thrift's Introduction

gunicorn_thrift

Build Status

Thrift app and worker for gunicorn!

Why?

  • graceful reload/shutdown.
  • manage worker number at runtime.
  • and everything else gunicorn has to offer.

Examples

  1. Generate thrift files:

    % thrift --out tests/pingpong_sdk --gen py:new_style,utf8strings tests/pingpong.thrift
  2. Write thrift app.

    #! /usr/bin/env python
    # tests/app.py
    # -*- coding: utf-8 -*-
    
    import os
    from pingpong_sdk.pingpong import PingService
    
    class PingpongServer(object):
        def ping(self):
            return "pong"
    
    app = PingService.Processor(PingpongServer())
  3. Fire up app.

    % gunicorn_thrift tests.app:app -k thrift_sync
    % gunicorn_thrift tests.app:app -k thrift_gevent

Configs

Workers

There are 4 types of workers avaiable.

  • thrift_sync: sync worker.
  • thrift_gevent: gevent worker.
  • thriftpy_sync: sync worker, adapted for thriftpy
  • thriftpy_gevent: gevent worker, adapted for thriftpy

Transport factory

The transport factory to use for handling connections.

default: thrift.transport.TTransport:TBufferedTransportFactory

Protocol factory

The protocol factory to use for parsing requests.

default: thrift.protocol.TBinaryProtocol:TBinaryProtocolAcceleratedFactory

Client timeout

Seconds to timeout a client if it is silent after this duration.

default: None (Never time out a client)

gunicorn_thrift's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.