diff --git a/frameworks/Python/crax/README.md b/frameworks/Python/crax/README.md deleted file mode 100644 index ffb69935b57..00000000000 --- a/frameworks/Python/crax/README.md +++ /dev/null @@ -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/) diff --git a/frameworks/Python/crax/benchmark_config.json b/frameworks/Python/crax/benchmark_config.json deleted file mode 100644 index a461cd62fab..00000000000 --- a/frameworks/Python/crax/benchmark_config.json +++ /dev/null @@ -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": "" - } - }] -} \ No newline at end of file diff --git a/frameworks/Python/crax/config.toml b/frameworks/Python/crax/config.toml deleted file mode 100644 index b640dfaac07..00000000000 --- a/frameworks/Python/crax/config.toml +++ /dev/null @@ -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" diff --git a/frameworks/Python/crax/crax.dockerfile b/frameworks/Python/crax/crax.dockerfile deleted file mode 100644 index 4b33e3a0fb6..00000000000 --- a/frameworks/Python/crax/crax.dockerfile +++ /dev/null @@ -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 \ No newline at end of file diff --git a/frameworks/Python/crax/crax_conf.py b/frameworks/Python/crax/crax_conf.py deleted file mode 100644 index 042c7445e6d..00000000000 --- a/frameworks/Python/crax/crax_conf.py +++ /dev/null @@ -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' diff --git a/frameworks/Python/crax/hello/__init__.py b/frameworks/Python/crax/hello/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/frameworks/Python/crax/hello/app.py b/frameworks/Python/crax/hello/app.py deleted file mode 100644 index 718489d18a1..00000000000 --- a/frameworks/Python/crax/hello/app.py +++ /dev/null @@ -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) diff --git a/frameworks/Python/crax/hello/templates/fortune.html b/frameworks/Python/crax/hello/templates/fortune.html deleted file mode 100644 index 4f0b3db447c..00000000000 --- a/frameworks/Python/crax/hello/templates/fortune.html +++ /dev/null @@ -1,10 +0,0 @@ - - -
| id | message |
|---|---|
| {{ fortune[0] }} | {{ fortune[1]|e }} |