Esempio n. 1
0
#!/usr/bin/env python

from cocaine.worker import Worker
from cocaine.decorators.wsgi import wsgi

from app import app

if __name__ == '__main__':
    W = Worker()
    W.run({"http": wsgi(app)})
Esempio n. 2
0
#!/usr/bin/python
# NB: this import have to be executed as early as possible
#     to guarantee proper initialization of ioloops in
#     each process of cocaine pool
import flowmastermind

from cocaine.decorators.wsgi import wsgi
from cocaine.worker import Worker

Worker().run({'http': wsgi(flowmastermind.app)})
Esempio n. 3
0
#!/usr/bin/python
# NB: this import have to be executed as early as possible
#     to guarantee proper initialization of ioloops in
#     each process of cocaine pool
import flowmastermind

from cocaine.decorators.wsgi import wsgi
from cocaine.worker import Worker


Worker().run({
    'http': wsgi(flowmastermind.app)
})
Esempio n. 4
0
#!/usr/bin/env python

from cocaine.worker import Worker
from cocaine.decorators.wsgi import wsgi

from app import app

W = Worker()

W.run({"http": wsgi(app)})
Esempio n. 5
0

def write(request, response):
    data = yield request.read()
    try:
        channel = yield storage.write(NAMESPACE, KEY, data, [])
        yield channel.rx.get()
        response.write("Ok")
    except Exception as err:
        response.error(-100, repr(err))
    finally:
        response.close()


def read(request, response):
    try:
        channel = yield storage.read(NAMESPACE, KEY)
        data = yield channel.rx.get()
        response.write(data)
    except Exception as err:
        response.error(-100, repr(err))
    finally:
        response.close()


if __name__ == '__main__':
    W = Worker()
    W.run({"write": write,
           "read": read,
           "http": wsgi(app)})
Esempio n. 6
0
storage = Service("storage")


def write(request, response):
    data = yield request.read()
    try:
        channel = yield storage.write(NAMESPACE, KEY, data, [])
        yield channel.rx.get()
        response.write("Ok")
    except Exception as err:
        response.error(-100, repr(err))
    finally:
        response.close()


def read(request, response):
    try:
        channel = yield storage.read(NAMESPACE, KEY)
        data = yield channel.rx.get()
        response.write(data)
    except Exception as err:
        response.error(-100, repr(err))
    finally:
        response.close()


if __name__ == '__main__':
    W = Worker()
    W.run({"write": write, "read": read, "http": wsgi(app)})