hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r663075 - in /hadoop/core/trunk/src/contrib/hod: CHANGES.txt bin/hod bin/ringmaster hodlib/Common/setup.py
Date Wed, 04 Jun 2008 12:48:39 GMT
Author: ddas
Date: Wed Jun  4 05:48:38 2008
New Revision: 663075

URL: http://svn.apache.org/viewvc?rev=663075&view=rev
Log:
HADOOP-2961: Avoids unnecessary checks for some configuration parameters related to service
configuration. Contributed by Vinod Kumar Vavilapalli.

Modified:
    hadoop/core/trunk/src/contrib/hod/CHANGES.txt
    hadoop/core/trunk/src/contrib/hod/bin/hod
    hadoop/core/trunk/src/contrib/hod/bin/ringmaster
    hadoop/core/trunk/src/contrib/hod/hodlib/Common/setup.py

Modified: hadoop/core/trunk/src/contrib/hod/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hod/CHANGES.txt?rev=663075&r1=663074&r2=663075&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hod/CHANGES.txt (original)
+++ hadoop/core/trunk/src/contrib/hod/CHANGES.txt Wed Jun  4 05:48:38 2008
@@ -15,6 +15,9 @@
  
   BUG FIXES
 
+    HADOOP-2961: Avoids unnecessary checks for some configuration parameters
+    related to service configuration. (Vinod Kumar Vavilapalli via ddas)
+
 Release 0.17.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/trunk/src/contrib/hod/bin/hod
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hod/bin/hod?rev=663075&r1=663074&r2=663075&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hod/bin/hod (original)
+++ hadoop/core/trunk/src/contrib/hod/bin/hod Wed Jun  4 05:48:38 2008
@@ -232,13 +232,13 @@
               False, False, True, True),
               
              ('host', 'hostname', 'Mapred hostname.', 
-              False, 'localhost', False, True),
+              False, 'localhost', False, False),
 
              ('info_port', 'pos_int', 'Mapred info port.',
-              False, None, True, True), 
+              False, None, False, False),
              
              ('tracker_port', 'pos_int', 'Mapred job tracker port.',
-              False, None, True, True),
+              False, None, False, False),
                         
              ('cmdline-params', 'keyval', 'Hadoop cmdline key/value list.',
               False, None, False, False),
@@ -261,13 +261,13 @@
               False, False, True, True),
              
              ('host', 'hostname', 'HDFS hostname.', 
-              False, 'localhost', False, True),
+              False, 'localhost', False, False),
              
              ('fs_port', 'pos_int', 'HDFS port.',
-              False, None, True, True),
+              False, None, False, False),
               
              ('info_port', 'pos_int', 'HDFS info port.',
-              False, None, True, True), 
+              False, None, False, False), 
              
              ('cmdline-params', 'keyval', 'Hadoop cmdline key/value list.',
               False, None, False, False),
@@ -388,6 +388,38 @@
       print >>sys.stderr,"error: %s not found. Specify the path to the HOD configuration
file, or define the environment variable %s under which a file named hodrc can be found."
% (hodOptions['config'], 'HOD_CONF_DIR')
       sys.exit(1)
   
+    # Conditional validation
+    statusMsgs = []
+
+    if hodConfig.normalizeValue('gridservice-hdfs', 'external'):
+      # For external HDFS
+      statusMsgs.extend(hodConfig.validateValue('gridservice-hdfs',
+                                                'fs_port'))
+      statusMsgs.extend(hodConfig.validateValue('gridservice-hdfs',
+                                                'info_port'))
+      statusMsgs.extend(hodConfig.validateValue('gridservice-hdfs',
+                                                'host'))
+    else:
+      hodConfig['gridservice-hdfs']['fs_port'] = 0 # Dummy
+      hodConfig['gridservice-hdfs']['info_port'] = 0 # Not used at all
+
+    if hodConfig.normalizeValue('gridservice-mapred', 'external'):
+      statusMsgs.extend(hodConfig.validateValue('gridservice-mapred',
+                                                'tracker_port'))
+      statusMsgs.extend(hodConfig.validateValue('gridservice-mapred',
+                                                'info_port'))
+      statusMsgs.extend(hodConfig.validateValue('gridservice-mapred',
+                                                'host'))
+    else:
+      hodConfig['gridservice-mapred']['tracker_port'] = 0 # Dummy
+      hodConfig['gridservice-mapred']['info_port'] = 0 # Not used at all
+
+    if len(statusMsgs) != 0:
+      for msg in statusMsgs:
+        print >>sys.stderr, msg
+      sys.exit(1)
+    # End of conditional validation
+
     status = True
     statusMsgs = []
   

Modified: hadoop/core/trunk/src/contrib/hod/bin/ringmaster
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hod/bin/ringmaster?rev=663075&r1=663074&r2=663075&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hod/bin/ringmaster (original)
+++ hadoop/core/trunk/src/contrib/hod/bin/ringmaster Wed Jun  4 05:48:38 2008
@@ -164,7 +164,7 @@
               False, None, False, False),
               
              ('pkgs', 'directory', "directory where the package is installed",
-              False, None, False, True)), 
+              False, None, False, False)), 
                
                
             'gridservice-hdfs' : (
@@ -193,7 +193,7 @@
               False, None, False, False),
 
              ('pkgs', 'directory', "directory where the package is installed",
-              False, None, False, True)),          
+              False, None, False, False)),          
              
              
             'hodring' : (
@@ -278,6 +278,22 @@
   log = None
 
   try:
+    statusMsgs = []
+    # Conditional validation
+    if not ringMasterOptions['ringmaster'].has_key('hadoop-tar-ball') or \
+        not ringMasterOptions['ringmaster']['hadoop-tar-ball']:
+      # If tarball is not used
+      if not ringMasterOptions.normalizeValue('gridservice-hdfs', 'external'):
+        # And if hdfs is not external, validate gridservice-hdfs.pkgs
+        statusMsgs.extend(ringMasterOptions.validateValue(
+                                                  'gridservice-hdfs', 'pkgs'))
+      statusMsgs.extend(ringMasterOptions.validateValue(
+                                                  'gridservice-mapred', 'pkgs'))
+
+    if len(statusMsgs) != 0:
+      raise Exception("%s" % statusMsgs)
+    # End of conditional validation
+
     (status, statusMsgs) = ringMasterOptions.verify()
     if not status:
       raise Exception("%s" % statusMsgs)

Modified: hadoop/core/trunk/src/contrib/hod/hodlib/Common/setup.py
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hod/hodlib/Common/setup.py?rev=663075&r1=663074&r2=663075&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hod/hodlib/Common/setup.py (original)
+++ hadoop/core/trunk/src/contrib/hod/hodlib/Common/setup.py Wed Jun  4 05:48:38 2008
@@ -26,7 +26,8 @@
 from ConfigParser import SafeConfigParser
 from optparse import OptionParser, IndentedHelpFormatter, OptionGroup
 from util import get_perms, replace_escapes
-from types import typeValidator, is_valid_type, typeToString
+from types import typeValidator, typeValidatorInstance, is_valid_type, \
+                  typeToString
 from hodlib.Hod.hod import hodHelp
 
 reEmailAddress = re.compile("^.*@.*$")
@@ -224,7 +225,7 @@
             
         return status
 
-    # 'private' method which prints an configuration error messages
+    # Prints configuration error messages
     def var_error(self, section, option, *addData):
         errorStrings = []  
         if not self._dict[section].has_key(option):
@@ -393,6 +394,24 @@
 
         return status,statusMsgs
 
+    def normalizeValue(self, section, option)  :
+      return typeValidatorInstance.normalize(
+                                  self._configDef[section][option]['type'],
+                                  self[section][option])
+
+    def validateValue(self, section, option):
+      # Validates a section.option and exits on error
+      valueInfo = typeValidatorInstance.verify(
+                                  self._configDef[section][option]['type'],
+                                  self[section][option])
+      if valueInfo['isValid'] == 1:
+        return []
+      else:
+        if valueInfo['errorData']:
+          return self.var_error(section, option, valueInfo['errorData'])
+        else:
+          return self.var_error(section, option)
+
 class config(SafeConfigParser, baseConfig):
     def __init__(self, configFile, configDef=None, originalDir=None, 
                  options=None, checkPerms=False):



Mime
View raw message