Browse Source

[python/vibora] Remove Vibora (#9649)

Vibora hasn't been updated in 6 years and the repo has been archived:
https://github.com/vibora-io/vibora
Petrik de Heus 5 months ago
parent
commit
d761d5632a

+ 0 - 46
frameworks/Python/vibora/README.md

@@ -1,46 +0,0 @@
-# [Vibora](https://github.com/vibora-io/vibora) Benchmark Test
-
-The information below is specific to Vibora. For further guidance, 
-review the [documentation](https://github.com/TechEmpower/FrameworkBenchmarks/wiki). 
-Also note that there is additional information that's provided in 
-the [Python README](../).
-
-This is the Python Vibora portion of a [benchmarking tests suite](../../) 
-comparing a variety of frameworks.
-
-All test implementations are located within a single file 
-([app.py](app.py)).
-
-## Description
-
-Vibora, Vibora + psycopg2
-
-### Database
-
-Postgres
-
-## Test URLs
-### JSON Encoding 
-
-http://localhost:8080/json
-
-### Single Row Random Query
-
-http://localhost:8080/db
-
-### Plaintext
-
-http://localhost:8080/plaintext
-
-
-
-The following tests cannot be currently run due to an issue with the framework
-[Details Here] = https://github.com/vibora-io/vibora/issues/223
-
-### Update random rows
-
-http://localhost:8080/updates/?queries=
-
-### Variable Row Query Test 
-
-http://localhost:8080/db?queries=

+ 0 - 115
frameworks/Python/vibora/app.py

@@ -1,115 +0,0 @@
-import multiprocessing
-import os
-from random import randint
-from operator import itemgetter
-
-from vibora import Vibora, Request, JsonResponse, Response
-from vibora.hooks import Events
-
-from db import Pool
-DEFAULT_POOL_SIZE = 1000//multiprocessing.cpu_count()
-
-READ_ROW_SQL = 'SELECT * FROM "world" WHERE id={0}'
-WRITE_ROW_SQL = 'UPDATE "world" SET "randomnumber"={0} WHERE id={1} RETURNING id, randomNumber'
-READ_ALL_FORTUNES = 'SELECT * FROM "fortune"'
-ADDITIONAL_ROW = [0, 'Additional fortune added at request time.']
-sort_fortunes_key = itemgetter(1)
-
-app = Vibora(template_dirs=['templates'])
-
-
[email protected](Events.BEFORE_SERVER_START)
-async def init_db(app: Vibora):
-    app.components.add(await Pool("postgresql://%s:%s@%s:5432/%s" % (os.getenv("PGUSER", "benchmarkdbuser"), os.getenv("PSPASS", "benchmarkdbpass"), os.getenv("PGADDR", "tfb-database"), os.getenv("PGDB", "hello_world")), max_size=int(os.getenv("PGPOOLSIZE", DEFAULT_POOL_SIZE))))
-
-
[email protected](Events.BEFORE_SERVER_STOP)
-async def close_db(app: Vibora):
-    await asyncio.wait_for(app.components.get(Pool).close(), timeout=10)
-
-
-def getQueriesTotal(params):
-    try:
-        queries = params['queries'][0]
-        query_count = int(queries)
-    except:
-        return 1
-
-    if query_count < 1:
-        return 1
-    if query_count > 500:
-        return 500
-    return query_count
-
-
-async def fetchWorld(pool):
-    async with pool.acquire() as conn:
-        return await conn.fetchrow(READ_ROW_SQL.format(randint(1, 10000)))
-
-
-async def updateWorld(world_id, pool):
-    async with pool.acquire() as conn:
-        return await conn.fetchrow(WRITE_ROW_SQL.format(randint(1, 10000), world_id))
-
-
-async def fetchMultipleWorlds(total, pool):
-    worlds = []
-    for x in range(total):
-        res = await fetchWorld(pool)
-        worlds.append({'id': res[0], 'randomNumber': res[1]})
-    return worlds
-
-
-async def updateMultipleWorlds(total, pool):
-    worlds = []
-    for x in range(total):
-        res = await fetchWorld(pool)
-        updated = await updateWorld(res[0], pool)
-        worlds.append({'id': updated[0], 'randomNumber': updated[1]})
-    return worlds
-
-
-async def fetchFortunes(pool):
-    async with pool.acquire() as conn:
-        return await conn.fetch(READ_ALL_FORTUNES)
-
-
[email protected]('/fortunes')
-async def fortunes(pool: Pool):
-    fortunes = await fetchFortunes(pool)
-    fortunes.append(ADDITIONAL_ROW)
-    fortunes.sort(key=sort_fortunes_key)
-    return await app.render('index.html', fortunes=fortunes)
-
-
[email protected]('/db')
-async def single_query(request: Request, pool: Pool):
-    res = await fetchWorld(pool)
-    return JsonResponse({'id': res[0], 'randomNumber': res[1]}, headers={'Server': 'Vibora'})
-
-
[email protected]('/plaintext')
-async def plaintext():
-    return Response(b'Hello, World!', headers={'Server': 'Vibora', 'Content-Type': 'text/plain'})
-
-
[email protected]('/json')
-async def json():
-    return JsonResponse({'message': 'Hello, World!'}, headers={'Server': 'Vibora'})
-
-
[email protected]('/queries')
-async def multiple_queries(request: Request, pool: Pool):
-    total_queries = getQueriesTotal(request.args)
-    worlds = await fetchMultipleWorlds(total_queries, pool)
-    return JsonResponse(worlds, headers={'Server': 'Vibora', 'Content-Type': 'application/json', 'Content-Length': str(total_queries)})
-
-
[email protected]('/updates')
-async def update_queries(request: Request, pool: Pool):
-    total_queries = getQueriesTotal(request.args)
-    worlds = await updateMultipleWorlds(total_queries, pool)
-    return JsonResponse(worlds, headers={'Server': 'Vibora', 'Content-Type': 'application/json', 'Content-Length': str(total_queries)})
-
-if __name__ == '__main__':
-    app.run(host="0.0.0.0", port=8000, workers=multiprocessing.cpu_count())

+ 0 - 24
frameworks/Python/vibora/benchmark_config.json

@@ -1,24 +0,0 @@
-{
-  "framework": "vibora",
-  "tests": [{
-    "default": {
-      "json_url": "/json",
-      "plaintext_url": "/plaintext",
-      "db_url": "/db",
-      "port": 8000,
-      "approach": "Realistic",
-      "classification": "Platform",
-      "framework": "vibora",
-      "language": "Python",
-      "flavor": "Python3",
-      "platform": "None",
-      "webserver": "None",
-      "os": "Linux",
-      "orm": "Full",
-      "database_os": "Linux",
-      "database": "Postgres",
-      "display_name": "Vibora",
-      "notes": ""
-    }
-  }]
-}

+ 0 - 16
frameworks/Python/vibora/config.toml

@@ -1,16 +0,0 @@
-[framework]
-name = "vibora"
-
-[main]
-urls.plaintext = "/plaintext"
-urls.json = "/json"
-urls.db = "/db"
-approach = "Realistic"
-classification = "Platform"
-database = "Postgres"
-database_os = "Linux"
-os = "Linux"
-orm = "Full"
-platform = "None"
-webserver = "None"
-versus = "None"

+ 0 - 36
frameworks/Python/vibora/db.py

@@ -1,36 +0,0 @@
-import asyncio
-from contextlib import asynccontextmanager
-import asyncpg
-
-
-class Connection(asyncpg.Connection):
-    async def reset(self, *, timeout=None):
-        pass
-
-
-class Pool:
-    def __init__(self, connect_url, max_size=10, connection_class=None):
-        self._connect_url = connect_url
-        self._connection_class = connection_class or Connection
-        self._queue = asyncio.LifoQueue(max_size)
-
-    def __await__(self):
-        return self._async_init__().__await__()
-
-    async def _async_init__(self):
-        for _ in range(self._queue.maxsize):
-            self._queue.put_nowait(await asyncpg.connect(self._connect_url, connection_class=self._connection_class))
-        return self
-
-    @asynccontextmanager
-    async def acquire(self):
-        conn = await self._queue.get()
-        try:
-            yield conn
-        finally:
-            self._queue.put_nowait(conn)
-
-    async def close(self):
-        for _ in range(self._queue.maxsize):
-            conn = await self._queue.get()
-            await conn.close()

+ 0 - 2
frameworks/Python/vibora/requirements.txt

@@ -1,2 +0,0 @@
-asyncpg==0.26.0
-git+https://github.com/IterableTrucks/vibora.git@a24bbf417a84df3a25f7e8901613a1c50ccfe63f#egg=vibora[fast]

+ 0 - 21
frameworks/Python/vibora/templates/index.html

@@ -1,21 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <title>Fortunes</title>
-</head>
-<body>
-    <table>
-        <tr>
-            <th>id</th>
-            <th>message</th>
-        </tr>
-        {% for fortune in fortunes %}
-        <tr>
-            <td>{{ fortune[0] }}</td>
-            <td>{{ fortune[1] }}</td>
-        </tr>
-        {% endfor %}
-    </table>
-</body>
-</html>

+ 0 - 11
frameworks/Python/vibora/vibora.dockerfile

@@ -1,11 +0,0 @@
-FROM python:3.10.6
-
-ADD ./ /vibora
-
-WORKDIR /vibora
-
-RUN pip3 install -r /vibora/requirements.txt
-
-EXPOSE 8000
-
-CMD ["python3", "app.py"]