Browse Source

Remove wheezyweb as last update in 2015 (#4404)

hal8k 6 years ago
parent
commit
886e1ad4c1

+ 0 - 41
frameworks/Python/wheezyweb/README.md

@@ -1,41 +0,0 @@
-# wheezy.web Benchmark Test 
-
-Single file test, [app.py](app.py)
-
-## Description
-
-wheezy.web WSGI web framework (https://pythonhosted.org/wheezy.web/)
-
-### Database
-
-(none at the moment)
-
-### Server
-
-* wheezy.web
-
-## Test URLs
-### JSON Encoding
-
-http://localhost:8080/json
-
-### Plaintext
-
-http://localhost:8080/plaintext
-
-### DB
-
-http://localhost:8080/db
-
-
-### Query
-
-http://localhost:8080/queries?queries=2
-
-### Update
-
-http://localhost:8080/updates?queries=2
-
-### Fortune
-
-http://localhost:8080/fortune

+ 0 - 164
frameworks/Python/wheezyweb/app.py

@@ -1,164 +0,0 @@
-import cgi
-import os
-import sys
-from functools import partial
-from operator import attrgetter
-from random import randint
-
-from wheezy.http import HTTPResponse
-from wheezy.http import WSGIApplication
-from wheezy.routing import url
-from wheezy.web.handlers import BaseHandler
-from wheezy.web.middleware import bootstrap_defaults
-from wheezy.web.middleware import path_routing_middleware_factory
-
-from wheezy.template.engine import Engine
-from wheezy.template.ext.core import CoreExtension
-from wheezy.template.loader import FileLoader
-
-from sqlalchemy.ext.declarative import declarative_base
-from sqlalchemy import create_engine, Column
-from sqlalchemy.types import String, Integer, Unicode
-from sqlalchemy.orm import sessionmaker
-
-from meinheld import server
-
-DBDRIVER = 'mysql'
-DBHOSTNAME = 'tfb-database'
-DATABASE_URI = '%s://benchmarkdbuser:benchmarkdbpass@%s:3306/hello_world?charset=utf8' % (DBDRIVER, DBHOSTNAME)
-
-Base = declarative_base()
-db_engine = create_engine(DATABASE_URI)
-Session = sessionmaker(bind=db_engine)
-db_session = Session()
-
-if sys.version_info[0] == 3:
-    xrange = range
-
-def getQueryNum(queryString):
-    try:
-        int(queryString)
-        return int(queryString)
-    except ValueError:
-        return 1
-
-class Fortune(Base):
-    __tablename__ = "Fortune"
-    id = Column(Integer, primary_key=True)
-    message = Column(String)
-
-    def serialize(self):
-        return {
-            'id': self.id,
-            'randomNumber': self.randomNumber,
-        }
-
-class World(Base):
-    __tablename__ = "World"
-    id = Column(Integer, primary_key=True)
-    randomNumber = Column(Integer)
-    def serialize(self):
-        return {
-            'id': self.id,
-            'randomNumber': self.randomNumber,
-        }
-
-class JsonHandler(BaseHandler):
-    def get(self):
-        response = self.json_response({"message": "Hello, World!"})
-        response.headers = [("Content-Type", "application/json; charset=UTF-8")]
-        return response
-
-class DbHandler(BaseHandler):
-    def get(self):
-        db_engine.connect()
-        wid = randint(1, 10000)
-        world = db_session.query(World).get(wid).serialize()
-        return self.json_response(world)
-
-class QueriesHandler(BaseHandler):
-    def get(self):
-        queries = self.request.get_param("queries")
-        num_queries = getQueryNum(queries)
-        if num_queries < 1:
-            num_queries = 1
-        if num_queries > 500:
-            num_queries = 500
-        rp = partial(randint, 1, 10000)
-        get = db_session.query(World).get
-        worlds = [get(rp()).serialize() for _ in xrange(num_queries)]
-        return self.json_response(worlds)
-
-class UpdatesHandler(BaseHandler):
-    def get(self):
-        queries = self.request.get_param("queries")
-        num_queries = getQueryNum(queries)
-        if num_queries < 1:
-            num_queries = 1
-        if num_queries > 500:
-            num_queries = 500
-        worlds = []
-        rp = partial(randint, 1, 10000)
-        ids = [rp() for _ in xrange(num_queries)]
-        ids.sort() # To avoid deadlock
-        for id in ids:
-            world = db_session.query(World).get(id)
-            world.randomNumber = rp()
-            worlds.append(world.serialize())
-        db_session.commit()
-        return self.json_response(worlds)
-
-
-template_engine = Engine(loader=FileLoader(["views"]), extensions=[CoreExtension()])
-template_engine.global_vars['escape'] = cgi.escape
-
-class FortuneHandler(BaseHandler):
-    def get(self):
-        fortunes = db_session.query(Fortune).all()
-        fortunes.append(Fortune(id=0, message="Additional fortune added at request time."))
-        fortunes.sort(key=attrgetter("message"))
-        template = template_engine.get_template("fortune.html")
-        template_html = template.render({"fortunes": fortunes})		
-
-        response = HTTPResponse()
-        response.write(template_html)
-        return response
-
-def plaintext(request):
-    response = HTTPResponse()
-    response.headers = [("Content-Type", "text/plain; charset=UTF-8")]
-    response.write("Hello, world!")
-    return response
-
-
-def sqlalchemy_close_middleware(request, following):
-    """Close db_session for each request"""
-    try:
-        return following(request)
-    finally:
-        db_session.remove()
-
-
-all_urls = [
-    url("plaintext", plaintext, name="plaintext"),
-    url("json", JsonHandler, name="json"),
-    url("db", DbHandler, name="db"),
-    url("queries", QueriesHandler, name="queries"),
-    url("updates", UpdatesHandler, name="updates"),
-    url("fortune", FortuneHandler, name="fortune")
-]
-
-options = {}
-
-app = WSGIApplication(
-    middleware = [
-        bootstrap_defaults(url_mapping=all_urls),
-        path_routing_middleware_factory,
-        lambda _: sqlalchemy_close_middleware,
-    ],
-    options = options
-)
-
-if __name__ == '__main__':
-    server.listen(("127.0.0.1", 8080))
-    server.run(app)

+ 0 - 49
frameworks/Python/wheezyweb/benchmark_config.json

@@ -1,49 +0,0 @@
-{
-  "framework": "wheezyweb",
-  "tests": [{
-    "default": {
-      "json_url": "/json",
-      "db_url": "/db",
-      "query_url": "/queries?queries=",
-      "fortune_url": "/fortune",
-      "update_url": "/updates?queries=",
-      "plaintext_url": "/plaintext",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Micro",
-      "database": "MySQL",
-      "framework": "wheezy.web",
-      "language": "Python",
-      "flavor": "Python2",
-      "orm": "Full",
-      "platform": "None",
-      "webserver": "Meinheld",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "wheezy.web",
-      "notes": ""
-    },
-    "py3": {
-      "json_url": "/json",
-      "db_url": "/db",
-      "query_url": "/queries?queries=",
-      "fortune_url": "/fortune",
-      "update_url": "/updates?queries=",
-      "plaintext_url": "/plaintext",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Micro",
-      "database": "MySQL",
-      "framework": "wheezy.web",
-      "language": "Python",
-      "flavor": "Python3",
-      "orm": "Full",
-      "platform": "None",
-      "webserver": "Meinheld",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "wheezy.web",
-      "notes": ""
-    }
-  }]
-}

+ 0 - 25
frameworks/Python/wheezyweb/gunicorn_conf.py

@@ -1,25 +0,0 @@
-import multiprocessing
-import os
-import sys
-
-_is_pypy = hasattr(sys, 'pypy_version_info')
-_is_travis = os.environ.get('TRAVIS') == 'true'
-
-workers = multiprocessing.cpu_count() * 3
-if _is_travis:
-    workers = 2
-
-bind = "0.0.0.0:8080"
-keepalive = 120
-errorlog = '-'
-pidfile = 'gunicorn.pid'
-
-if _is_pypy:
-    worker_class = "tornado"
-else:
-    worker_class = "meinheld.gmeinheld.MeinheldWorker"
-
-    def post_fork(server, worker):
-        # Disalbe access log
-        import meinheld.server
-        meinheld.server.set_access_logger(None)

+ 0 - 14
frameworks/Python/wheezyweb/requirements.lock

@@ -1,14 +0,0 @@
-greenlet==0.4.14
-gunicorn==19.9.0
-meinheld==0.6.1
-mysqlclient==1.3.7
-SQLAlchemy==1.0.12
-wheezy.caching==0.1.114
-wheezy.core==0.1.140
-wheezy.html==0.1.147
-wheezy.http==0.1.344
-wheezy.routing==0.1.157
-wheezy.security==0.1.64
-wheezy.template==0.1.167
-wheezy.validation==0.1.135
-wheezy.web==0.1.485

+ 0 - 10
frameworks/Python/wheezyweb/requirements.txt

@@ -1,10 +0,0 @@
-wheezy.web
-wheezy.template
-
-SQLAlchemy
-mysqlclient
-
-gunicorn
-meinheld
-
-greenlet

+ 0 - 22
frameworks/Python/wheezyweb/views/fortune.html

@@ -1,22 +0,0 @@
-@require(fortunes)
-<!DOCTYPE html>
-<html>
-<head>
-<title>Fortunes</title>
-</head>
-<body>
-<table>
-<tr>
-<th>id</th>
-<th>message</th>
-</tr>
-@for fortune in fortunes:
-<tr>
-<td>@str(fortune.id)</td>
-<td>@{fortune.message !! escape}</td>
-</tr>
-@end
-</table>
-</body>
-</html>
-

+ 0 - 9
frameworks/Python/wheezyweb/wheezyweb-py3.dockerfile

@@ -1,9 +0,0 @@
-FROM python:3.6.6-stretch
-
-ADD ./ /wheezyweb
-
-WORKDIR /wheezyweb
-
-RUN pip3 install -r /wheezyweb/requirements.txt
-
-CMD gunicorn app:app -c gunicorn_conf.py

+ 0 - 9
frameworks/Python/wheezyweb/wheezyweb.dockerfile

@@ -1,9 +0,0 @@
-FROM python:2.7.15-stretch
-
-ADD ./ /wheezyweb
-
-WORKDIR /wheezyweb
-
-RUN pip install -r /wheezyweb/requirements.txt
-
-CMD gunicorn app:app -c gunicorn_conf.py