Return-Path: Delivered-To: apmail-hadoop-core-commits-archive@www.apache.org Received: (qmail 48395 invoked from network); 4 Jun 2008 12:49:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Jun 2008 12:49:01 -0000 Received: (qmail 21223 invoked by uid 500); 4 Jun 2008 12:49:04 -0000 Delivered-To: apmail-hadoop-core-commits-archive@hadoop.apache.org Received: (qmail 21204 invoked by uid 500); 4 Jun 2008 12:49:03 -0000 Mailing-List: contact core-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: core-dev@hadoop.apache.org Delivered-To: mailing list core-commits@hadoop.apache.org Received: (qmail 21195 invoked by uid 99); 4 Jun 2008 12:49:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Jun 2008 05:49:03 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Jun 2008 12:48:22 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E213C2388A2A; Wed, 4 Jun 2008 05:48:39 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: core-commits@hadoop.apache.org From: ddas@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080604124839.E213C2388A2A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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):