You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by de...@apache.org on 2019/02/12 14:00:27 UTC

svn commit: r1853437 - /uima/uima-ducc/trunk/src/main/admin/ducc_update

Author: degenaro
Date: Tue Feb 12 14:00:27 2019
New Revision: 1853437

URL: http://svn.apache.org/viewvc?rev=1853437&view=rev
Log:
UIMA-5985 ducc_update needs to employ check_ducc like functionality to prevent updating when DUCC is already running

Modified:
    uima/uima-ducc/trunk/src/main/admin/ducc_update

Modified: uima/uima-ducc/trunk/src/main/admin/ducc_update
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/admin/ducc_update?rev=1853437&r1=1853436&r2=1853437&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/ducc_update (original)
+++ uima/uima-ducc/trunk/src/main/admin/ducc_update Tue Feb 12 14:00:27 2019
@@ -45,6 +45,7 @@ import datetime
 import fnmatch
 import re
 import shutil
+import subprocess
 
 global preserveFiles
 global preserveDirectories
@@ -207,7 +208,26 @@ def update_directory(olddir, newdir, arc
     if nleft == 0:
         os.rmdir(newdir)
 
-
+#-----------------------------------------------------------------------------------------
+# Insure ducc not running
+#-----------------------------------------------------------------------------------------
+def check_ducc(runtime):
+    print 'checking for ducc running, may take a few minutes...'
+    cmd = [ os.path.join(runtime,'admin/check_ducc') ]
+    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=1, universal_newlines=True)
+    while True:
+        output = p.stdout.readline()
+        if output == '' and p.poll() is not None:
+            break
+        if output:
+            line = output.strip()
+            #print line
+            if('Found ducc' in line):
+                print "ERROR - DUCC appears to be running ... please run '" + os.path.join(runtime,'admin/stop_ducc') + " -a'"
+                exit(1)
+    rc = p.poll()
+    return rc
+    
 #=========================================================================================
 # Main program:
 #    tarfile runtime
@@ -246,6 +266,8 @@ rtime   = sys.argv[1]
 tarfile = sys.argv[2]
 runtime = os.path.realpath(rtime)
 
+check_ducc(runtime)
+
 if not os.path.exists(tarfile):
     print "ERROR - Missing tar file", tarfile
     exit(1)