Browse Source

Added play-activate-mysql

Fixed a bug where the process would not successfully terminate
reliably after completing the tests.
tfb 11 years ago
parent
commit
9226b5f6eb
2 changed files with 10 additions and 8 deletions
  1. 1 2
      play-activate-mysql/benchmark_config
  2. 9 6
      play-activate-mysql/setup.py

+ 1 - 2
play-activate-mysql/benchmark_config

@@ -20,8 +20,7 @@
       "database_os": "Linux",
       "display_name": "play-scala-activate",
       "notes": "",
-      "versus": "netty",
-      "skip": "true"
+      "versus": "netty"
     }
   }]
 }

+ 9 - 6
play-activate-mysql/setup.py

@@ -27,12 +27,7 @@ def stop():
       pid = int(f.read())
       os.kill(pid, 9)
   else:
-    p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
-    out, err = p.communicate()
-    for line in out.splitlines():
-      if 'NettyServer' in line:
-        pid = int(line.split(None, 2)[1])
-        os.kill(pid, 9)
+    kill_running_process()
 
   try:
     os.remove("play-activate-mysql/target/universal/play-activate-mysql-1.0-SNAPSHOT/RUNNING_PID")
@@ -40,3 +35,11 @@ def stop():
     pass
 
   return 0
+
+def kill_running_process():
+  try:
+    with open("./play-activate-mysql/target/universal/play-activate-mysql-1.0-SNAPSHOT/RUNNING_PID") as f:
+      pid = int(f.read())
+      os.kill(pid,9)
+  except:
+    pass