-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import json | ||
import os | ||
import requests | ||
import subprocess | ||
import sys | ||
import threading | ||
import time | ||
|
||
from djangocms import waitUntilUp | ||
|
||
if __name__ == "__main__": | ||
exe = sys.executable | ||
|
||
times = [] | ||
|
||
p = subprocess.Popen([exe, "../data/pyramid_serve.py"], stdout=open("/dev/null", "w"), stderr=subprocess.STDOUT, cwd=os.path.dirname(__file__)) | ||
try: | ||
waitUntilUp(("127.0.0.1", 8000)) | ||
|
||
n = 1800*2 | ||
if len(sys.argv) > 1: | ||
n = int(sys.argv[1]) | ||
|
||
start = time.time() | ||
for i in range(n): | ||
times.append(time.time()) | ||
if i % 100 == 0: | ||
print(i, time.time() - start) | ||
requests.get("http://localhost:8000/").text | ||
times.append(time.time()) | ||
elapsed = time.time() - start | ||
print("%.2fs (%.3freq/s)" % (elapsed, n / elapsed)) | ||
|
||
assert p.poll() is None, p.poll() | ||
|
||
finally: | ||
p.terminate() | ||
p.wait() | ||
|
||
if len(sys.argv) > 2: | ||
json.dump(times, open(sys.argv[2], 'w')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
PasteDeploy==2.1.1 | ||
certifi==2020.12.5 | ||
chardet==3.0.4 | ||
hupper==1.10.2 | ||
idna==2.10 | ||
plaster==1.0 | ||
plaster-pastedeploy==0.7 | ||
pyramid==2.0 | ||
requests==2.24.0 | ||
translationstring==1.4 | ||
urllib3==1.25.11 | ||
venusian==3.0.0 | ||
webob==1.8.7 | ||
zope.deprecation==4.4.0 | ||
zope.interface==5.4.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from wsgiref.simple_server import make_server | ||
from pyramid.config import Configurator | ||
from pyramid.response import Response | ||
|
||
def hello_world(request): | ||
return Response('Hello World!') | ||
|
||
if __name__ == '__main__': | ||
with Configurator() as config: | ||
config.add_route('hello', '/') | ||
config.add_view(hello_world, route_name='hello') | ||
app = config.make_wsgi_app() | ||
server = make_server('0.0.0.0', 8000, app) | ||
server.serve_forever() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters