Procházet zdrojové kódy

[python/crax] Remove crax (#9644)

Crax is currently failing and hasn't been updated in 5 years: https://github.com/crax-framework/crax
Petrik de Heus před 6 měsíci
rodič
revize
594a2e7180

+ 0 - 22
frameworks/Python/crax/README.md

@@ -1,22 +0,0 @@
-# [Crax](https://crax.wiki/) Benchmark Test
-
-This is the Crax portion of a [benchmarking tests suite](../../)
-comparing a variety of web development platforms.
-
-The information below is specific to Crax. For further guidance,
-review the [documentation](https://github.com/TechEmpower/FrameworkBenchmarks/wiki).
-Also note that there is additional information provided in
-the [Python README](../).
-
-## Description
-
-[Crax](https://github.com/crax-framework/crax) is a framework or a pack of tools for web development.
-
-## Test Paths & Sources
-
-All of the test implementations are located within a single file ([app.py](hello/app.py)).
-
-## Resources
-
-* [Crax on GitHub](https://github.com/crax-framework/crax)
-* [Crax Wiki](https://crax.wiki/)

+ 0 - 27
frameworks/Python/crax/benchmark_config.json

@@ -1,27 +0,0 @@
-{
-  "framework": "crax",
-  "tests": [{
-    "default": {
-      "json_url": "/json",
-      "fortune_url": "/fortunes",
-      "plaintext_url": "/plaintext",
-      "db_url": "/db",
-      "query_url": "/queries?queries=",
-      "update_url": "/updates?queries=",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "micro",
-      "framework": "crax",
-      "language": "Python",
-      "flavor": "Python3",
-      "platform": "None",
-      "webserver": "None",
-      "os": "Linux",
-      "orm": "Raw",
-      "database_os": "Linux",
-      "database": "Postgres",
-      "display_name": "Crax",
-      "notes": ""
-    }
-  }]
-}

+ 0 - 19
frameworks/Python/crax/config.toml

@@ -1,19 +0,0 @@
-[framework]
-name = "crax"
-
-[main]
-urls.plaintext = "/plaintext"
-urls.json = "/json"
-urls.db = "/db"
-urls.query = "/queries?queries="
-urls.update = "/updates?queries="
-urls.fortune = "/fortunes"
-approach = "Realistic"
-classification = "micro"
-database = "Postgres"
-database_os = "Linux"
-os = "Linux"
-orm = "Raw"
-platform = "None"
-webserver = "None"
-versus = "None"

+ 0 - 12
frameworks/Python/crax/crax.dockerfile

@@ -1,12 +0,0 @@
-FROM python:3.8
-
-ADD ./ /crax
-
-WORKDIR /crax
-
-RUN pip3 install cython==0.29.13 && \
-    pip3 install -r /crax/requirements.txt
-
-EXPOSE 8080
-
-CMD gunicorn hello.app:app -k uvicorn.workers.UvicornWorker -c crax_conf.py

+ 0 - 14
frameworks/Python/crax/crax_conf.py

@@ -1,14 +0,0 @@
-import multiprocessing
-import os
-
-_is_travis = os.environ.get('TRAVIS') == 'true'
-
-workers = multiprocessing.cpu_count()
-if _is_travis:
-    workers = 2
-
-bind = "0.0.0.0:8080"
-keepalive = 120
-errorlog = '-'
-pidfile = '/tmp/crax.pid'
-loglevel = 'error'

+ 0 - 0
frameworks/Python/crax/hello/__init__.py


+ 0 - 90
frameworks/Python/crax/hello/app.py

@@ -1,90 +0,0 @@
-import os
-from operator import itemgetter
-from random import randint
-import asyncpg
-from crax import Crax
-from crax.response_types import BaseResponse, JSONResponse
-from crax.urls import Route, Url
-from crax.views import JSONView, TemplateView
-
-READ_ROW_SQL = 'SELECT "id", "randomnumber" FROM "world" WHERE id = $1'
-WRITE_ROW_SQL = 'UPDATE "world" SET "randomnumber"=$1 WHERE id=$2'
-
-
-async def setup_database():
-    global connection_pool
-    connection_pool = await asyncpg.create_pool(
-        user=os.getenv('PGUSER', 'benchmarkdbuser'),
-        password=os.getenv('PGPASS', 'benchmarkdbpass'),
-        database='hello_world',
-        host='tfb-database',
-        port=5432
-    )
-
-
-def get_num_queries(request):
-    try:
-        query_count = int(request.query["queries"][0])
-    except (KeyError, IndexError, ValueError):
-        return 1
-    if query_count < 1:
-        return 1
-    if query_count > 500:
-        return 500
-    return query_count
-
-
-class TestSingleQuery(JSONView):
-    async def get(self):
-        row_id = randint(1, 10000)
-        async with connection_pool.acquire() as connection:
-            if self.request.path == '/db':
-                res = await connection.fetchval(READ_ROW_SQL, row_id)
-                self.context = {'id': row_id, 'randomNumber': res}
-
-
-class TestMultiQueries(JSONView):
-    async def get(self):
-        row_ids = [randint(1, 10000) for _ in range(get_num_queries(self.request))]
-        worlds = []
-        async with connection_pool.acquire() as connection:
-            statement = await connection.prepare(READ_ROW_SQL)
-            for row_id in row_ids:
-                number = await statement.fetchval(row_id)
-                worlds.append({'id': row_id, 'randomNumber': number})
-            self.context = worlds
-
-
-class TestUpdates(JSONView):
-    async def get(self):
-        updates = [(randint(1, 10000), randint(1, 10000)) for _ in range(get_num_queries(self.request))]
-        worlds = [{'id': row_id, 'randomNumber': number} for row_id, number in updates]
-        async with connection_pool.acquire() as connection:
-            statement = await connection.prepare(READ_ROW_SQL)
-            for row_id, number in updates:
-                await statement.fetchval(row_id)
-            await connection.executemany(WRITE_ROW_SQL, updates)
-            self.context = worlds
-
-
-class TestSingleFortunes(TemplateView):
-    template = "fortune.html"
-
-    async def get(self):
-        async with connection_pool.acquire() as connection:
-            fortunes = await connection.fetch('SELECT * FROM Fortune')
-            fortunes.append([0, 'Additional fortune added at request time.'])
-            fortunes.sort(key=itemgetter(1))
-            self.context["fortunes"] = fortunes
-
-
-APPLICATIONS = ["hello"]
-URL_PATTERNS = [
-    Route(Url('/json'), JSONResponse(None, {'message': 'Hello, world!'})),
-    Route(Url('/plaintext'), BaseResponse(None, b'Hello, world!')),
-    Route(Url('/db'), TestSingleQuery),
-    Route(Url('/queries'), TestMultiQueries),
-    Route(Url('/updates'), TestUpdates),
-    Route(Url('/fortunes'), TestSingleFortunes)
-]
-app = Crax('hello.app', debug=True, on_startup=setup_database)

+ 0 - 10
frameworks/Python/crax/hello/templates/fortune.html

@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head><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]|e }}</td></tr>
-{% endfor %}</table>
-</body>
-</html>

+ 0 - 5
frameworks/Python/crax/requirements.txt

@@ -1,5 +0,0 @@
-crax[postgresql]==0.1.5
-gunicorn==20.1.0
-uvloop==0.17.0
-uvicorn==0.20.0
-httptools==0.5.0