Skip to content

Instantly share code, notes, and snippets.

View vortec's full-sized avatar

Fabian Kochem vortec

View GitHub Profile
hug_test:
Requests per second: 4318.00 [#/sec] (mean)
Complete requests: 20000
falcon_test:
Requests per second: 4756.76 [#/sec] (mean)
Complete requests: 20000
flask_test:
Requests per second: 3197.57 [#/sec] (mean)
Complete requests: 20000
bobo_test:
hug_test:
Requests per second: 576.28 [#/sec] (mean)
Complete requests: 20000
falcon_test:
Requests per second: 583.47 [#/sec] (mean)
Complete requests: 20000
flask_test:
Requests per second: 582.66 [#/sec] (mean)
Complete requests: 20000
bobo_test:
[ERROR] Internal Server Error: /auth/login/
Traceback (most recent call last):
File "/opt/sentry/local/lib/python2.7/site-packages/sentry/../django/core/handlers/base.py", line 112, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/sentry/local/lib/python2.7/site-packages/sentry/../django/views/generic/base.py", line 69, in view
return self.dispatch(request, *args, **kwargs)
File "/opt/sentry/local/lib/python2.7/site-packages/sentry/../django/utils/decorators.py", line 29, in _wrapper
return bound_func(*args, **kwargs)
File "/opt/sentry/local/lib/python2.7/site-packages/sentry/../django/utils/decorators.py", line 99, in _wrapped_view
response = view_func(request, *args, **kwargs)
# Will be started via hug -m
import endpoints
import hug
from libtree import Tree
from libtree.core.database import make_dsn_from_env
import psycopg2
import os
dsn = make_dsn_from_env(os.environ)

hug_store_redis

Build Status Coverage Status Scrutinizer Code Quality

hug_store_redis is a Redis store extension for the Python framework hug, which can be used as a session store.

Installation

$ py.test tests
==================================================== test session starts ====================================================
platform darwin -- Python 3.4.1 -- py-1.4.30 -- pytest-2.7.2
rootdir: /Users/vortec/workspace/code/hug, inifile:
plugins: cov, xdist, xdist, xdist
collected 356 items
tests/test_api.py ..
tests/test_authentication.py ...
tests/test_decorators.py ...............................................................
@hug.authentication.authenticator
def header_exists(request, response, verify_user, **kwargs):
print("yo")
return {'user': 'foo'}
@hug.get('/test', requires=header_exists)
def test(user: hug.directives.user):
return "hai"
import time
from threading import Thread
from kazoo.client import KazooState
def create_nodes_after_reconnect(zk):
time.sleep(0.1)
for (service_path, data) in zk.ka_nodes.items():
register_service(zk, service_path, data, keep_alive=True)
import uuid
class SessionNotFound(Exception):
pass
class InMemoryStore:
""" not thread-safe ;-) """
def __init__(self):
self.sessions = {}
(devpi)[root@ci] ~devpi/var # devpi-server --port 8020 --serverdir /opt/devpi/var/slave_test --role=master
2015-10-30 16:20:06,417 INFO NOCTX Loading node info from /opt/devpi/var/slave_test/.nodeinfo
2015-10-30 16:20:06,417 INFO NOCTX wrote nodeinfo to: /opt/devpi/var/slave_test/.nodeinfo
Traceback (most recent call last):
File "/opt/devpi/bin/devpi-server", line 11, in <module>
sys.exit(main())
File "/opt/devpi/local/lib/python2.7/site-packages/devpi_server/main.py", line 51, in main
return _main(pluginmanager, argv=argv)
File "/opt/devpi/local/lib/python2.7/site-packages/devpi_server/main.py", line 83, in _main
with xom.keyfs.transaction(write=True):