#!/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)})
#!/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)})
#!/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) })
#!/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)})
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)})
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)})