[Swift-commit] r4948 - SwiftApps/GOSwift/pykoa/tools

jonmon at ci.uchicago.edu jonmon at ci.uchicago.edu
Fri Aug 5 10:12:04 CDT 2011


Author: jonmon
Date: 2011-08-05 10:12:04 -0500 (Fri, 05 Aug 2011)
New Revision: 4948

Modified:
   SwiftApps/GOSwift/pykoa/tools/koa_goswift_manage.py
Log:
o go_swift_manage can now stop a Swift execution by the id number.



Modified: SwiftApps/GOSwift/pykoa/tools/koa_goswift_manage.py
===================================================================
--- SwiftApps/GOSwift/pykoa/tools/koa_goswift_manage.py	2011-08-05 05:14:57 UTC (rev 4947)
+++ SwiftApps/GOSwift/pykoa/tools/koa_goswift_manage.py	2011-08-05 15:12:04 UTC (rev 4948)
@@ -45,14 +45,17 @@
         return 1
 
     processes = [ppid]
-    # BROKEN: Doesn't parse the 'ps' output correctly. Fix the 'parsed_line' split delimiter
     for line in output.split("\n"):
         parsed_line = line.split()
-        if ppid == parsed_line[2]:
-            processes.append(parsed_line[1])
+        try:
+            new_ppid = int(parsed_line[2])
+        except ValueError:
+            new_ppid = -1
+        if ppid == new_ppid:
+            processes.append(int(parsed_line[1]))
             ppid = int(parsed_line[1])
-    
     for pid in processes:
+        # Handle error in which process has already been stopped.
         os.kill(pid, 9)
 
     return 0
@@ -67,6 +70,7 @@
         return 1
 
     if options.stop:
+        sys.stdout.write("Stopping Swift run number: "+args[0]+"\n")
         ret = stop(args[0])
 
     return ret




More information about the Swift-commit mailing list