JiaLiangC commented on code in PR #3695: URL: https://github.com/apache/ambari/pull/3695#discussion_r1204939684
########## ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/SPARK/service_advisor.py: ########## @@ -289,85 +274,39 @@ def removeValueFromProperty(self, putConfigProperty, config, propertyName, prope else: putConfigProperty(propertyName, str(config[propertyName]).replace(separator + propertyValue, "")) - def __addZeppelinToLivy2SuperUsers(self, configurations, services): - """ - If Kerberos is enabled AND Zeppelin is installed AND Spark2 Livy Server is installed, then set - livy2-conf/livy.superusers to contain the Zeppelin principal name from - zeppelin-site/zeppelin.server.kerberos.principal - - :param configurations: - :param services: - """ - if Spark2ServiceAdvisor.isKerberosEnabled(services, configurations): - zeppelin_site = self.getServicesSiteProperties(services, "zeppelin-site") - - if zeppelin_site and 'zeppelin.server.kerberos.principal' in zeppelin_site: - zeppelin_principal = zeppelin_site['zeppelin.server.kerberos.principal'] - zeppelin_user = zeppelin_principal.split('@')[0] if zeppelin_principal else None - - if zeppelin_user: - livy2_conf = self.getServicesSiteProperties(services, 'livy2-conf') - - if livy2_conf: - superusers = livy2_conf['livy.superusers'] if livy2_conf and 'livy.superusers' in livy2_conf else None - # add the Zeppelin user to the set of users - if superusers: - _superusers = superusers.split(',') - _superusers = [x.strip() for x in _superusers] - _superusers = filter(None, _superusers) # Removes empty string elements from array - else: - _superusers = [] - if zeppelin_user not in _superusers: - _superusers.append(zeppelin_user) - - putLivy2ConfProperty = self.putProperty(configurations, 'livy2-conf', services) - putLivy2ConfProperty('livy.superusers', ','.join(_superusers)) - - -class Spark2Validator(service_advisor.ServiceAdvisor): +class SparkValidator(service_advisor.ServiceAdvisor): """ - Spark2 Validator checks the correctness of properties whenever the service is first added or the user attempts to + Spark Validator checks the correctness of properties whenever the service is first added or the user attempts to change configs via the UI. """ def __init__(self, *args, **kwargs): - self.as_super = super(Spark2Validator, self) + self.as_super = super(SparkValidator, self) self.as_super.__init__(*args, **kwargs) - self.validators = [("spark2-defaults", self.validateSpark2DefaultsFromHDP25), - ("spark2-thrift-sparkconf", self.validateSpark2ThriftSparkConfFromHDP25), - ("spark2-atlas-application-properties-override", self.validateSpark2AtlasApplicationPropertiesFromHDP30)] - - - def validateSpark2DefaultsFromHDP25(self, properties, recommendedDefaults, configurations, services, hosts): - validationItems = [ - { - "config-name": 'spark.yarn.queue', - "item": self.validatorYarnQueue(properties, recommendedDefaults, 'spark.yarn.queue', services) - } - ] - return self.toConfigurationValidationProblems(validationItems, "spark2-defaults") + self.validators = [("spark-defaults", self.validateSparkDefaultsFromHDP25), + ("spark-atlas-application-properties-override", self.validateSparkAtlasApplicationPropertiesFromHDP30)] - def validateSpark2ThriftSparkConfFromHDP25(self, properties, recommendedDefaults, configurations, services, hosts): + def validateSparkDefaultsFromHDP25(self, properties, recommendedDefaults, configurations, services, hosts): Review Comment: Spark-thrift-conf is no longer maintained in Spark 3. In Spark 2, Spark Thrift Server (STS) used spark-thrift-conf to configure the Thrift service. However, in Spark 3, STS has been migrated to Spark SQL and no longer uses spark-thrift-conf for configuration. Instead, you can use Spark SQL configuration files, such as spark-defaults.conf, to configure STS. Therefore, I have merged all the configurations from spark-thrift-conf into spark-defaults, which is the reason for the function merge you see. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@ambari.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@ambari.apache.org For additional commands, e-mail: dev-h...@ambari.apache.org