Browse Source

verify Trying to clean up after run

Mike Smith 11 years ago
parent
commit
baffaac3a2
3 changed files with 22 additions and 25 deletions
  1. 10 11
      plain/setup.py
  2. 1 1
      play-activate-mysql/conf/application.conf
  3. 11 13
      play-activate-mysql/setup.py

+ 10 - 11
plain/setup.py

@@ -18,22 +18,21 @@ def start(args, logfile, errfile):
 def stop(logfile, errfile):
   if os.name == 'nt':
     subprocess.call("taskkill /f /im *plain-benchmark* > NUL", shell=True, stderr=errfile, stdout=logfile)
-    return 0
+  else:
+    p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
+    out, err = p.communicate()
+    for line in out.splitlines():
+      if 'plain-benchmark' in line:
+        try:
+          pid = int(line.split(None, 2)[1])
+          os.kill(pid, 15)
+        except OSError:
+          return 1
 
   # Takes up so much disk space
   if os.name == 'nt':
     subprocess.check_call("del /f /s /q target && del /f /s /q project", shell=True, cwd="plain", stderr=errfile, stdout=logfile)
   else:
     subprocess.check_call("rm -rf target && rm -rf project", shell=True, cwd="plain", stderr=errfile, stdout=logfile)
-
-  p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
-  out, err = p.communicate()
-  for line in out.splitlines():
-    if 'plain-benchmark' in line:
-      try:
-        pid = int(line.split(None, 2)[1])
-        os.kill(pid, 15)
-      except OSError:
-        pass
   
   return 0

+ 1 - 1
play-activate-mysql/conf/application.conf

@@ -70,7 +70,7 @@ iteratee-threadpool-size=300
 play {
   akka {
     event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]
-    loglevel = WARNING
+    loglevel = ERROR
     actor {
       default-dispatcher = {
         fork-join-executor {

+ 11 - 13
play-activate-mysql/setup.py

@@ -22,24 +22,22 @@ def start(args, logfile, errfile):
 
   return 0
 def stop(logfile, errfile):
-  if os.name == 'nt':
+  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)
-  else:
-    kill_running_process()
+      os.kill(pid,15)
+  except:
+    return 1
 
   try:
     os.remove("play-activate-mysql/target/universal/play-activate-mysql-1.0-SNAPSHOT/RUNNING_PID")
   except OSError:
-    pass
+    return 1
 
-  return 0
+  # Takes up so much disk space
+  if os.name == 'nt':
+    subprocess.check_call("del /f /s /q target", shell=True, cwd="play-activate-mysql", stderr=errfile, stdout=logfile)
+  else:
+    subprocess.check_call("rm -rf target", shell=True, cwd="play-activate-mysql", stderr=errfile, stdout=logfile)
 
-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
+  return 0