[13/34] ambari git commit: AMBARI-20327. HDP 3.0 TP - create Service Advisor for HBase.(vbrodetskyi)
AMBARI-20327. HDP 3.0 TP - create Service Advisor for HBase.(vbrodetskyi) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/381a4b1a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/381a4b1a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/381a4b1a Branch: refs/heads/branch-feature-AMBARI-12556 Commit: 381a4b1a751bd6428af919f78e33bb63a0b62c25 Parents: 7f53d18 Author: Vitaly Brodetskyi Authored: Tue Apr 25 14:11:41 2017 +0300 Committer: Vitaly Brodetskyi Committed: Tue Apr 25 14:11:41 2017 +0300 -- .../HBASE/2.0.0.3.0/service_advisor.py | 675 +++ 1 file changed, 675 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/381a4b1a/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/service_advisor.py -- diff --git a/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/service_advisor.py b/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/service_advisor.py new file mode 100644 index 000..f9d1a59 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/service_advisor.py @@ -0,0 +1,675 @@ +#!/usr/bin/env ambari-python-wrap +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +# Python imports +import imp +import os +import traceback +import re +import socket +import fnmatch + + +from resource_management.core.logger import Logger + +SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) +STACKS_DIR = os.path.join(SCRIPT_DIR, '../../../stacks/') +PARENT_FILE = os.path.join(STACKS_DIR, 'service_advisor.py') + +try: + with open(PARENT_FILE, 'rb') as fp: +service_advisor = imp.load_module('service_advisor', fp, PARENT_FILE, ('.py', 'rb', imp.PY_SOURCE)) +except Exception as e: + traceback.print_exc() + print "Failed to load parent" + +class HBASEServiceAdvisor(service_advisor.ServiceAdvisor): + + def __init__(self, *args, **kwargs): +self.as_super = super(HBASEServiceAdvisor, self) +self.as_super.__init__(*args, **kwargs) + +# Always call these methods +self.modifyMastersWithMultipleInstances() +self.modifyCardinalitiesDict() +self.modifyHeapSizeProperties() +self.modifyNotValuableComponents() +self.modifyComponentsNotPreferableOnServer() +self.modifyComponentLayoutSchemes() + + def modifyMastersWithMultipleInstances(self): +""" +Modify the set of masters with multiple instances. +Must be overriden in child class. +""" +self.mastersWithMultipleInstances.add("HBASE_MASTER") + + def modifyCardinalitiesDict(self): +""" +Modify the dictionary of cardinalities. +Must be overriden in child class. +""" +self.cardinalitiesDict["HBASE_MASTER"] = {"min": 1} + + def modifyHeapSizeProperties(self): +""" +Modify the dictionary of heap size properties. +Must be overriden in child class. +""" +self.heap_size_properties = {"REGIONSERVER": + [{"config-name": "hbase-env", + "property": "hbase_regionserver_heapsize", + "default": "1024m"}], + "HBASE_MASTER": + [{"config-name": "hbase-env", + "property": "hbase_master_heapsize", + "default": "1024m"}]} + + def modifyNotValuableComponents(self): +""" +Modify the set of components whose host assignment is based on other services. +Must be overriden in child class. +""" +# Nothing to do +pass + + def modifyComponentsNotPreferableOnServer(self): +""" +Modify the set of components that are not preferable on the server. +Must be overriden in child class. +""" +# Nothing to do +pass + + def modifyComponentLayoutSchemes(self): +""" +Modify layout scheme dictionaries for components. +The scheme dictionary basically maps the number of hosts to +host index whe
ambari git commit: AMBARI-20327. HDP 3.0 TP - create Service Advisor for HBase.(vbrodetskyi)
Repository: ambari Updated Branches: refs/heads/trunk 7f53d1819 -> 381a4b1a7 AMBARI-20327. HDP 3.0 TP - create Service Advisor for HBase.(vbrodetskyi) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/381a4b1a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/381a4b1a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/381a4b1a Branch: refs/heads/trunk Commit: 381a4b1a751bd6428af919f78e33bb63a0b62c25 Parents: 7f53d18 Author: Vitaly Brodetskyi Authored: Tue Apr 25 14:11:41 2017 +0300 Committer: Vitaly Brodetskyi Committed: Tue Apr 25 14:11:41 2017 +0300 -- .../HBASE/2.0.0.3.0/service_advisor.py | 675 +++ 1 file changed, 675 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/381a4b1a/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/service_advisor.py -- diff --git a/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/service_advisor.py b/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/service_advisor.py new file mode 100644 index 000..f9d1a59 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/service_advisor.py @@ -0,0 +1,675 @@ +#!/usr/bin/env ambari-python-wrap +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +# Python imports +import imp +import os +import traceback +import re +import socket +import fnmatch + + +from resource_management.core.logger import Logger + +SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) +STACKS_DIR = os.path.join(SCRIPT_DIR, '../../../stacks/') +PARENT_FILE = os.path.join(STACKS_DIR, 'service_advisor.py') + +try: + with open(PARENT_FILE, 'rb') as fp: +service_advisor = imp.load_module('service_advisor', fp, PARENT_FILE, ('.py', 'rb', imp.PY_SOURCE)) +except Exception as e: + traceback.print_exc() + print "Failed to load parent" + +class HBASEServiceAdvisor(service_advisor.ServiceAdvisor): + + def __init__(self, *args, **kwargs): +self.as_super = super(HBASEServiceAdvisor, self) +self.as_super.__init__(*args, **kwargs) + +# Always call these methods +self.modifyMastersWithMultipleInstances() +self.modifyCardinalitiesDict() +self.modifyHeapSizeProperties() +self.modifyNotValuableComponents() +self.modifyComponentsNotPreferableOnServer() +self.modifyComponentLayoutSchemes() + + def modifyMastersWithMultipleInstances(self): +""" +Modify the set of masters with multiple instances. +Must be overriden in child class. +""" +self.mastersWithMultipleInstances.add("HBASE_MASTER") + + def modifyCardinalitiesDict(self): +""" +Modify the dictionary of cardinalities. +Must be overriden in child class. +""" +self.cardinalitiesDict["HBASE_MASTER"] = {"min": 1} + + def modifyHeapSizeProperties(self): +""" +Modify the dictionary of heap size properties. +Must be overriden in child class. +""" +self.heap_size_properties = {"REGIONSERVER": + [{"config-name": "hbase-env", + "property": "hbase_regionserver_heapsize", + "default": "1024m"}], + "HBASE_MASTER": + [{"config-name": "hbase-env", + "property": "hbase_master_heapsize", + "default": "1024m"}]} + + def modifyNotValuableComponents(self): +""" +Modify the set of components whose host assignment is based on other services. +Must be overriden in child class. +""" +# Nothing to do +pass + + def modifyComponentsNotPreferableOnServer(self): +""" +Modify the set of components that are not preferable on the server. +Must be overriden in child class. +""" +# Nothing to do +pass + + def modifyComponentLayoutSchemes(self): +""" +Modify layout scheme dictionaries for components. +The scheme dictionar