Author: challngr Date: Mon Aug 5 20:39:18 2013 New Revision: 1510717 URL: http://svn.apache.org/r1510717 Log: UIMA-3012 Single user mode -s can be specified on start_ducc to inhibit ducc_ling checks.
Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/ducc.py uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py uima/sandbox/uima-ducc/trunk/src/main/admin/start_ducc Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/ducc.py URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/ducc.py?rev=1510717&r1=1510716&r2=1510717&view=diff ============================================================================== --- uima/sandbox/uima-ducc/trunk/src/main/admin/ducc.py (original) +++ uima/sandbox/uima-ducc/trunk/src/main/admin/ducc.py Mon Aug 5 20:39:18 2013 @@ -56,7 +56,7 @@ class Ducc(DuccUtil): print "Started AMQ broker" - def run_component(self, component, or_parms, numagents, rmoverride, background, nodup, localdate): + def run_component(self, component, or_parms, numagents, rmoverride, background, nodup, localdate, single_user): if ( component == 'all' ): component = 'rm,sm,pm,ws,orchestrator' @@ -86,11 +86,14 @@ class Ducc(DuccUtil): if ( not self.check_clock_skew(localdate) ): return - dok = self.verify_duccling() - if ( not dok ): - print 'NOTOK ducc_ling is not set up correctly on node', self.localhost - print dok - return + if ( not single_user ) : + dok = self.verify_duccling() + if ( not dok ): + print 'NOTOK ducc_ling is not set up correctly on node', self.localhost + print dok + return + else: + print 'Single user mode: bypassing ducc_ling checks.' if ( not verify_slave_node(localdate, self.ducc_properties) ): # we assume that verify_local_node is spewing a line of the form @@ -218,6 +221,7 @@ class Ducc(DuccUtil): print ' -n <numagents> if > 1, multiple agents are started (testing mode)' print ' -o <mem-in-GB> rm memory override for use on small machines' print ' -k causes the entire DUCC system to shutdown' + print ' -s start in single-user mode (inhibit some sanity checks)' print ' --nodup If specified, do not start a process if it appears to be already started.' print ' --or_parms [cold|warm|hot]' print ' --ducc_head nodename the name of the "ducc head" where ducc is started from' @@ -233,11 +237,12 @@ class Ducc(DuccUtil): shutdown = False background = False or_parms = None + single_user = False nodup = False # we allow duplicates unless asked not to localdate = 0 try: - opts, args = getopt.getopt(argv, 'bc:d:n:o:k?v', ['or_parms=', 'nodup' ]) + opts, args = getopt.getopt(argv, 'bc:d:n:o:sk?v', ['or_parms=', 'nodup' ]) except: self.usage('Bad arguments ' + ' '.join(argv)) @@ -256,6 +261,8 @@ class Ducc(DuccUtil): rmoverride = a elif ( o == '-k'): shutdown = True + elif ( o == '-s'): + single_user = True elif ( o == '--or_parms' ): or_parms = a elif ( o == '--nodup' ): @@ -279,7 +286,7 @@ class Ducc(DuccUtil): if ( component == 'broker' ): self.run_broker(background) else: - self.run_component(component, or_parms, numagents, rmoverride, background, nodup, localdate) + self.run_component(component, or_parms, numagents, rmoverride, background, nodup, localdate, single_user) return def __call__(self, *args): Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py?rev=1510717&r1=1510716&r2=1510717&view=diff ============================================================================== --- uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py (original) +++ uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py Mon Aug 5 20:39:18 2013 @@ -106,6 +106,7 @@ class DuccUtil(DuccBase): # tcp 0 0 :::61616 :::* LISTEN for line in lines: toks = line.split() + #print '[]', line if ( toks[-1] == 'LISTEN' ): port = toks[3] if (port.endswith(self.broker_port)): Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/start_ducc URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/start_ducc?rev=1510717&r1=1510716&r2=1510717&view=diff ============================================================================== --- uima/sandbox/uima-ducc/trunk/src/main/admin/start_ducc (original) +++ uima/sandbox/uima-ducc/trunk/src/main/admin/start_ducc Mon Aug 5 20:39:18 2013 @@ -56,7 +56,7 @@ class StartDucc(DuccUtil): print 'Waiting for broker', str(i) time.sleep(1) - def start_component(self, ducc, component, or_parms): + def start_component(self, ducc, component, or_parms, single_user): node = self.ducc_properties.get('ducc.head') com = component @@ -82,7 +82,11 @@ class StartDucc(DuccUtil): if ( node == 'local' ): node = self.localhost - lines = self.ssh(node, True, "'", self.DUCC_HOME + '/admin/ducc.py', '-c', com, '-b', or_parms, '-d', str(time.time()), '--nodup', "'") + if ( single_user ): + lines = self.ssh(node, True, "'", self.DUCC_HOME + '/admin/ducc.py', '-c', com, '-s', '-b', or_parms, '-d', str(time.time()), '--nodup', "'") + else: + lines = self.ssh(node, True, "'", self.DUCC_HOME + '/admin/ducc.py', '-c', com, '-b', or_parms, '-d', str(time.time()), '--nodup', "'") + # we'll capture anything that the python shell spews because it may be useful, and then drop the # pipe when we see a PID message while 1: @@ -102,7 +106,7 @@ class StartDucc(DuccUtil): if ( com in self.default_components ): # tracks where the management processes are self.pids.put(com, com + '@' + node) - def start_agents(self, nodelist): + def start_agents(self, nodelist, single_user): # print 'NODELIST', nodelist #counter = 1 @@ -112,7 +116,11 @@ class StartDucc(DuccUtil): spacer = ' ' print host - lines = self.ssh(host, True, "'", self.DUCC_HOME + '/admin/ducc.py', '-c' 'agent', '-b', '-d', str(time.time()), '--nodup', "'") + if (single_user): + lines = self.ssh(host, True, "'", self.DUCC_HOME + '/admin/ducc.py', '-c' 'agent', '-s', '-b', '-d', str(time.time()), '--nodup', "'") + else: + lines = self.ssh(host, True, "'", self.DUCC_HOME + '/admin/ducc.py', '-c' 'agent', '-b', '-d', str(time.time()), '--nodup', "'") + while 1: line = lines.readline().strip() #print '[l]' + line @@ -170,6 +178,10 @@ class StartDucc(DuccUtil): print " -m --management" print " Start the management processes (rm, sm, pm, webserver, orchestrator) on the local node." print "" + print " -s --singleuser" + print " Start ducc in 'single user mode'. This bypasses some checking required for multi-user" + print " mode and not required for single-user mode." + print "" print " -c, --component component" print " Start a specific DUCC component, optionally on a specific node. If the component name" print " is qualified with a nodename, the component is started on that node. To qualify a" @@ -224,13 +236,14 @@ class StartDucc(DuccUtil): nodefiles = [] components = [] - management = False + management = True + single_user = False or_parms = self.ducc_properties.get('ducc.orchestrator.start.type') self.pids = DuccProperties() self.pids.load_if_exists(self.pid_file) try: - opts, args = getopt.getopt(argv, 'c:mn:h?v', ['component=', 'components=', 'help', 'nodelist=', 'management', 'cold', 'warm', 'hot']) + opts, args = getopt.getopt(argv, 'c:mn:sh?v', ['component=', 'components=', 'help', 'nodelist=', 'management', 'singleuser', 'cold', 'warm', 'hot']) except: self.invalid('Invalid arguments', ' '.join(argv)) @@ -241,6 +254,8 @@ class StartDucc(DuccUtil): management = True elif o in ( '-n', '--nodelist' ): nodefiles.append(a) + elif o in ( '-s', '--singleuser' ): + single_user = True elif o in ( '--cold', '--warm', '--hot' ): or_parms = o[2:] # (strip the leading --) elif ( o == '-v'): @@ -249,17 +264,17 @@ class StartDucc(DuccUtil): elif o in ( '-h', '--help' ): self.usage(None) elif ( o == '-?'): - self.usage(None) + self.usage(None) else: self.invalid('bad args: ', ' '.join(argv)) # 'management' means start all the management daemons - if specific components are also specified # there is at least a redundancy and maybe also a conflict. if ( (len(components) != 0) and management ): - self.invalid("The --management and --compoent options are mutually exclusive") + self.invalid("The --management and --component options are mutually exclusive") - # no args - make equivalent of -management and -nodefile=DUCC.HOME/resources/ducc.nodes - if ( len(argv) == 0 ): + # no args, or just -s - make equivalent of -management and -nodefile=DUCC.HOME/resources/ducc.nodes + if ( (len(argv) == 0) or ((len(argv) == 1) and single_user) ): nodefiles = self.default_nodefiles components = self.default_components must_verify_nodepools = True @@ -320,7 +335,7 @@ class StartDucc(DuccUtil): for (nodefile, nodelist) in nodes.items(): print '********** Starting agents from file', nodefile - self.start_agents(nodelist) + self.start_agents(nodelist, single_user) if ( len(components) != 0 ): print 'Starting', or_parms @@ -329,7 +344,7 @@ class StartDucc(DuccUtil): if ( com == 'broker' ): pass # already started else: - self.start_component(ducc, com, or_parms) + self.start_component(ducc, com, or_parms, single_user) else: print 'Not starting management components.'