Browse Source

set sort order and fix setup file

Patrick Falls 12 years ago
parent
commit
465f2e84a0
2 changed files with 11 additions and 11 deletions
  1. 1 1
      dart/benchmark_config
  2. 10 10
      dart/setup.py

+ 1 - 1
dart/benchmark_config

@@ -9,7 +9,7 @@
       "fortune_url": "/fortunes",
       "update_url": "/update?queries=",
       "port": 8080,
-      "sort": ???
+      "sort": 129
     }
   }]
 }

+ 10 - 10
dart/setup.py

@@ -3,7 +3,7 @@ import sys
 import setup_util
 import os
 
-DART_SDK = os.environ('DART_SDK')
+#DART_SDK = os.environ('DART_SDK')
 
 def start(args):
   setup_util.replace_text('dart/postgresql.yaml', 'host: .*', 'host: ' + args.database_host)
@@ -11,12 +11,12 @@ def start(args):
     #
     # install dart dependencies
     #
-    subprocess.Popen(DART_SDK + 'bin/pub install', shell=True, cwd='dart')
+    subprocess.check_call('pub install', shell=True, cwd='dart')
     #
     # start dart servers
     #
-    for port in range(9001, 9001 + args.max_threads)
-      subprocess.Popen(DART_SDK + 'bin/dart server.dart -a 127.0.0.1 -p ' + str(port) + ' -d ' + str(args.max_concurrency / args.max_threads), shell=True, cwd='dart')
+    for port in range(9001, 9001 + args.max_threads):
+      subprocess.Popen('dart server.dart -a 127.0.0.1 -p ' + str(port) + ' -d ' + str(args.max_concurrency / args.max_threads), shell=True, cwd='dart')
     #
     # create nginx configuration
     #
@@ -28,11 +28,11 @@ def start(args):
     conf.append('}')
     conf.append('http {')
     conf.append('    access_log off;')
-    conf.append('    include mime.types;')
+    conf.append('    include /usr/local/nginx/conf/mime.types;')
     conf.append('    default_type application/octet-stream;')
     conf.append('    sendfile on;')
     conf.append('    upstream dart_cluster {')
-    for port in range(9001, 9001 + args.max_threads)
+    for port in range(9001, 9001 + args.max_threads):
       conf.append('        server 127.0.0.1:' + str(port) + ';')
     conf.append('    }')
     conf.append('    server {')
@@ -46,13 +46,13 @@ def start(args):
     #
     # write nginx configuration to disk
     #
-    os.remove('dart/nginx.conf')
+    #os.remove('dart/nginx.conf')
     with open('dart/nginx.conf', 'w') as f:
       f.write('\n'.join(conf))
     #
     # start nginx
     #
-    subprocess.Popen('nginx -c `pwd`/nginx.conf', shell=True, cwd='dart');
+    subprocess.Popen('sudo /usr/local/nginx/sbin/nginx -c `pwd`/nginx.conf', shell=True, cwd='dart');
     return 0
   except subprocess.CalledProcessError:
     return 1
@@ -61,7 +61,7 @@ def stop():
   #
   # stop nginx
   #
-  subprocess.Popen('nginx -c `pwd`/nginx.conf -s stop', shell=True, cwd='dart')
+  subprocess.check_call('sudo /usr/local/nginx/sbin/nginx -c `pwd`/nginx.conf -s stop', shell=True, cwd='dart')
   os.remove('dart/nginx.conf')
   #
   # stop dart servers
@@ -69,7 +69,7 @@ def stop():
   p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
   out, err = p.communicate()
   for line in out.splitlines():
-    if 'dart' in line:
+    if 'dart' in line and 'run-tests' not in line:
       pid = int(line.split(None, 2)[1])
       os.kill(pid, 9)
   return 0