Browse Source

django-stripped: Add django-stripped-py3 (243)

INADA Naoki 12 years ago
parent
commit
0b3ad62b3c
3 changed files with 45 additions and 0 deletions
  1. 8 0
      django-stripped/benchmark_config
  2. 3 0
      django-stripped/setup.py
  3. 34 0
      django-stripped/setup_py3.py

+ 8 - 0
django-stripped/benchmark_config

@@ -8,6 +8,14 @@
       "query_url": "/db?queries=",
       "query_url": "/db?queries=",
       "port": 8080,
       "port": 8080,
       "sort": 33
       "sort": 33
+    },
+    "py3": {
+      "setup_file": "setup_py3",
+      "json_url": "/json",
+      "db_url": "/db",
+      "query_url": "/db?queries=",
+      "port": 8080,
+      "sort": 243
     }
     }
   }]
   }]
 }
 }

+ 3 - 0
django-stripped/setup.py

@@ -3,6 +3,7 @@ import setup_util
 import multiprocessing
 import multiprocessing
 import os
 import os
 
 
+home = os.path.expanduser('~')
 bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py2/bin')
 bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py2/bin')
 NCPU = multiprocessing.cpu_count()
 NCPU = multiprocessing.cpu_count()
 
 
@@ -12,6 +13,7 @@ proc = None
 def start(args):
 def start(args):
     global proc
     global proc
     setup_util.replace_text("django-stripped/hello/hello/settings.py", "HOST': '.*'", "HOST': '" + args.database_host + "'")
     setup_util.replace_text("django-stripped/hello/hello/settings.py", "HOST': '.*'", "HOST': '" + args.database_host + "'")
+    setup_util.replace_text("django-stripped/hello/hello/settings.py", "\/home\/ubuntu",  home)
     proc = subprocess.Popen([
     proc = subprocess.Popen([
         bin_dir + "/gunicorn",
         bin_dir + "/gunicorn",
         "hello.wsgi:application",
         "hello.wsgi:application",
@@ -27,5 +29,6 @@ def stop():
     if proc is None:
     if proc is None:
         return 0
         return 0
     proc.terminate()
     proc.terminate()
+    proc.wait()
     proc = None
     proc = None
     return 0
     return 0

+ 34 - 0
django-stripped/setup_py3.py

@@ -0,0 +1,34 @@
+import subprocess
+import setup_util
+import multiprocessing
+import os
+
+home = os.path.expanduser('~')
+bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py3/bin')
+NCPU = multiprocessing.cpu_count()
+
+proc = None
+
+
+def start(args):
+    global proc
+    setup_util.replace_text("django-stripped/hello/hello/settings.py", "HOST': '.*'", "HOST': '" + args.database_host + "'")
+    setup_util.replace_text("django-stripped/hello/hello/settings.py", "\/home\/ubuntu",  home)
+    proc = subprocess.Popen([
+        bin_dir + "/gunicorn",
+        "hello.wsgi:application",
+        "-k", "meinheld.gmeinheld.MeinheldWorker",
+        "-b", "0.0.0.0:8080",
+        '-w', str(NCPU*3),
+        "--log-level=critical"],
+        cwd="django-stripped/hello")
+    return 0
+
+def stop():
+    global proc
+    if proc is None:
+        return 0
+    proc.terminate()
+    proc.wait()
+    proc = None
+    return 0