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 2016/12/14 22:04:34 UTC
svn commit: r1774350 - in /uima/uima-ducc/trunk: src/main/admin/ducc_util.py
src/main/admin/move_ducc
uima-ducc-common/src/main/java/org/apache/uima/ducc/common/NodeConfiguration.java
Author: degenaro
Date: Wed Dec 14 22:04:33 2016
New Revision: 1774350
URL: http://svn.apache.org/viewvc?rev=1774350&view=rev
Log:
UIMA-5193 DUCC failover support (static)
- enhance NodeConfigruation with -m <node> flag to return nodepool for given node
- enhance ducc_util.py with new get_nodepool(node) function
- enhance move_ducc to employ get_nodepool(node) for head and target node and assure agreement
Modified:
uima/uima-ducc/trunk/src/main/admin/ducc_util.py
uima/uima-ducc/trunk/src/main/admin/move_ducc
uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/NodeConfiguration.java
Modified: uima/uima-ducc/trunk/src/main/admin/ducc_util.py
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/admin/ducc_util.py?rev=1774350&r1=1774349&r2=1774350&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/ducc_util.py (original)
+++ uima/uima-ducc/trunk/src/main/admin/ducc_util.py Wed Dec 14 22:04:33 2016
@@ -981,6 +981,37 @@ class DuccUtil(DuccBase):
return (rc == 0)
+ def get_nodepool(self, node, default=''):
+ classpath = '/users1/degenaro/svn/apache/ducc/workspace/deploy-bluejws67.real/ducc_runtime/lib/uima-ducc/uima-ducc-common-2.2.0-SNAPSHOT.jar';
+ classpath = self.DUCC_HOME+'/lib/uima-ducc/uima-ducc-common-2.2.0-SNAPSHOT.jar'
+ classpath = '"'+self.DUCC_HOME+'/lib/uima-ducc/*'+'"'
+ #print classpath
+ classfile = self.ducc_properties.get('ducc.rm.class.definitions')
+ #print 'classfile: '+classfile
+ cmd = ''
+ cmd = cmd+self.jvm
+ cmd = cmd + ' '
+ cmd = cmd+'-cp '+classpath
+ cmd = cmd + ' '
+ cmd = cmd+'-DDUCC_HOME='+self.DUCC_HOME
+ cmd = cmd + ' '
+ cmd = cmd+'org.apache.uima.ducc.common.NodeConfiguration'
+ cmd = cmd + ' '
+ cmd = cmd+'-c'+' '+classfile
+ cmd = cmd + ' '
+ cmd = cmd+'-m'+' '+node
+ cmd = ''.join(cmd)
+ #print 'cmd: '+cmd
+ p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
+ (out, err) = p.communicate()
+ status = p.wait()
+ result = out.strip()
+ if(result == ''):
+ result = default
+ #print 'result: '+result
+ #print 'status: '+str(status)
+ return result
+
def disable_threading(self):
global use_threading
use_threading = False
Modified: uima/uima-ducc/trunk/src/main/admin/move_ducc
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/admin/move_ducc?rev=1774350&r1=1774349&r2=1774350&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/move_ducc (original)
+++ uima/uima-ducc/trunk/src/main/admin/move_ducc Wed Dec 14 22:04:33 2016
@@ -207,6 +207,7 @@ class MoveDucc(DuccUtil):
key = 'ducc.head'
prop = props.get_property(key)
node = prop.v
+ self.head = node
message = message = 'node='+node+' '+'checking ducc head node daemons status'
print_info(message)
operational = self.ssh_operational(node)
@@ -239,6 +240,23 @@ class MoveDucc(DuccUtil):
else :
print_info(message)
+
+ def vette_nodepool(self):
+ default = '<None>'
+ node = self.head
+ np_head = str(self.get_nodepool(node,default))
+ node = self.target
+ np_target = str(self.get_nodepool(node,default))
+ if(not np_target == np_head):
+ message = 'node='+self.head+' nodepool='+np_head
+ print_warn(message)
+ message = 'node='+self.target+' nodepool='+np_target
+ print_warn(message)
+ message = 'nodepools do not match'
+ print_warn(message)
+ self.code = 1
+ self.abort()
+
# backup file
def backup_file(self,root,stem):
timestamp = str(get_timestamp()).replace(' ','@')
@@ -326,6 +344,7 @@ class MoveDucc(DuccUtil):
self.initialize()
self.vette_target()
self.vette_head()
+ self.vette_nodepool()
self.config_backup()
self.config_update()
Modified: uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/NodeConfiguration.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/NodeConfiguration.java?rev=1774350&r1=1774349&r2=1774350&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/NodeConfiguration.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/NodeConfiguration.java Wed Dec 14 22:04:33 2016
@@ -1332,7 +1332,12 @@ public class NodeConfiguration
printUser(p);
}
}
-
+
+ public void printNodepool(String nodepool) {
+ String methodName = "printConfiguration";
+ logInfo(methodName, nodepool);
+ }
+
static void usage(String msg)
{
if ( msg != null ) {
@@ -1342,9 +1347,10 @@ public class NodeConfiguration
System.out.println("Usage:");
System.out.println(" NodeConfiguration [-c class-definitions] [-n nodefile] [-u userfile] [-p] <configfile>");
System.out.println("Where:");
- System.out.println(" -c <class-definitions> is the class definition file, usually ducc.classes.");
- System.out.println(" -n <nodefile> is nodefile used with tye system, defaults to ducc.nodes");
+ System.out.println(" -c <class-definitions> is the class definition file, defaults to ducc.classes.");
+ System.out.println(" -n <nodefile> is nodefile used with the system, defaults to ducc.nodes");
System.out.println(" -u <userfile> is the user registry.");
+ System.out.println(" -m Prints the nodepool for the given node.");
System.out.println(" -p Prints the parsed configuration, for verification.");
System.out.println(" -? show this help.");
System.out.println("");
@@ -1358,9 +1364,10 @@ public class NodeConfiguration
{
boolean doprint = false;
- String nodefile = null;
+ String nodefile = "ducc.nodes";
String userfile = null;
- String config = null;
+ String config = "ducc.classes";
+ String mapNodeToPool = null;
int i = 0;
@@ -1390,6 +1397,11 @@ public class NodeConfiguration
continue;
}
+ if ( args[i].equals("-m") ) {
+ mapNodeToPool = args[i+1];
+ i++;
+ continue;
+ }
if ( args[i].equals("-?") ) {
usage(null);
@@ -1410,9 +1422,15 @@ public class NodeConfiguration
int rc = 0;
try {
nc.readConfiguration(); // if it doesn't crash it must have worked
-
+ if(mapNodeToPool != null) {
+ String nodepool = nc.getNodePoolNameForNode(mapNodeToPool);
+ if(nodepool == null) {
+ nodepool = "";
+ }
+ nc.printNodepool(nodepool);
+ }
if ( doprint ) {
- nc.printConfiguration();
+ nc.printConfiguration();
}
} catch (FileNotFoundException e) {
System.out.println("Configuration file " + config + " does not exist or cannot be read.");