Raphael Javaux 12 years ago
parent
commit
e774d0e88d
4 changed files with 68 additions and 0 deletions
  1. 32 0
      yesod/README.md
  2. 0 0
      yesod/__init__.py
  3. 13 0
      yesod/benchmark_config
  4. 23 0
      yesod/setup.py

+ 32 - 0
yesod/README.md

@@ -0,0 +1,32 @@
+# Yesod Benchmarking Test
+
+This is the Yesod portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
+
+### JSON Encoding Test
+
+* [JSON test source](hello/world/views.py)
+
+
+### Data-Store/Database Mapping Test
+
+* [DB test controller](hello/world/views.py)
+* [DB test model](hello/world/models.py)
+
+
+## Infrastructure Software Versions
+The tests were run with:
+* GHC 7.4.1
+* Yesod
+
+## Test URLs
+### JSON Encoding Test
+
+http://localhost:3000/json
+
+### Data-Store/Database Mapping Test
+
+http://localhost:3000/db
+
+### Variable Query Test
+
+http://localhost:3000/db2/2

+ 0 - 0
yesod/__init__.py


+ 13 - 0
yesod/benchmark_config

@@ -0,0 +1,13 @@
+{
+  "framework": "yesod",
+  "tests": [{
+    "default": {
+      "setup_file": "setup",
+      "json_url": "/json",
+      "db_url": "/db",
+      "query_url": "/db2/",
+      "port": 3000,
+      "sort": 33
+    }
+  }]
+}

+ 23 - 0
yesod/setup.py

@@ -0,0 +1,23 @@
+
+import subprocess
+import sys
+import setup_util
+import os
+
+def start(args):
+  setup_util.replace_text("django/hello/hello/settings.py", "HOST': '.*'", "HOST': '" + args.database_host + "'")
+
+  subprocess.Popen("gunicorn hello.wsgi:application -b 0.0.0.0:8080 -w " + str((args.max_threads * 2)) + " --log-level=critical", shell=True, cwd="django/hello")
+  return 0
+def stop():
+  p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
+  out, err = p.communicate()
+  for line in out.splitlines():
+    if 'gunicorn' in line:
+      try:
+        pid = int(line.split(None, 2)[1])
+        os.kill(pid, 9)
+      except OSError:
+        pass
+
+  return 0