def saveNewCapacitySchedulerConfig(registry, capacitySchedulerConfigFile): logging.info("Saving New Capacity Scheduler Config"); schedulerConf = open(capacitySchedulerConfigFile, 'r') schedulerData = schedulerConf.read() schedulerConf.close() schedulerData=str.replace(schedulerData,'version1400618703537','version'+str(int(time.time()*1000))) logging.debug(schedulerData) AmbariUtils.restPUT(registry, registry['clusterName'],schedulerData)
def saveNewCapacitySchedulerConfig(registry, capacitySchedulerConfigFile): logging.info("Saving New Capacity Scheduler Config") schedulerConf = open(capacitySchedulerConfigFile, 'r') schedulerData = schedulerConf.read() schedulerConf.close() schedulerData = str.replace(schedulerData, 'version1400618703537', 'version' + str(int(time.time() * 1000))) logging.debug(schedulerData) AmbariUtils.restPUT(registry, registry['clusterName'], schedulerData)
def configurePropertiesForYarnLabels(registry, yarnSiteVersion): #Get Current YARN-SITE & Add Preemption Values to Dict orgYARNProps = (json.loads(AmbariUtils.restGET(registry, registry['clusterName']+'/configurations?type=yarn-site&tag='+yarnSiteVersion)))['items'][0]['properties'] logging.info(orgYARNProps); orgYARNProps['yarn.node-labels.manager-class']='org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager' orgYARNProps['yarn.node-labels.fs-store.root-dir']='hdfs://vetticaden01.cloud.hortonworks.com:8020/yarn/node-labels' # On a Typical VM Node where you have less than 8 GB of memory, decrease the memory to 682 from 1024 or slider with node labels wont' work orgYARNProps['yarn.scheduler.minimum-allocation-mb']='682' #fix single quotes pythng dict issue with json.dumps orgYARNProps = json.dumps(orgYARNProps) newYARNSite = json.loads('{"Clusters": {"desired_config": {"type": "yarn-site","tag": "version'+str(int(time.time()*1000))+'", "properties": '+ orgYARNProps +'}}}') logging.info('newYARNSite ' + json.dumps(newYARNSite)) AmbariUtils.restPUT(registry, registry['clusterName'], json.dumps(newYARNSite))
def configurePropertiesForYarnLabels(registry, yarnSiteVersion): #Get Current YARN-SITE & Add Preemption Values to Dict orgYARNProps = (json.loads( AmbariUtils.restGET( registry, registry['clusterName'] + '/configurations?type=yarn-site&tag=' + yarnSiteVersion)))['items'][0]['properties'] logging.info(orgYARNProps) orgYARNProps[ 'yarn.node-labels.manager-class'] = 'org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager' orgYARNProps[ 'yarn.node-labels.fs-store.root-dir'] = 'hdfs://vetticaden01.cloud.hortonworks.com:8020/yarn/node-labels' # On a Typical VM Node where you have less than 8 GB of memory, decrease the memory to 682 from 1024 or slider with node labels wont' work orgYARNProps['yarn.scheduler.minimum-allocation-mb'] = '682' #fix single quotes pythng dict issue with json.dumps orgYARNProps = json.dumps(orgYARNProps) newYARNSite = json.loads( '{"Clusters": {"desired_config": {"type": "yarn-site","tag": "version' + str(int(time.time() * 1000)) + '", "properties": ' + orgYARNProps + '}}}') logging.info('newYARNSite ' + json.dumps(newYARNSite)) AmbariUtils.restPUT(registry, registry['clusterName'], json.dumps(newYARNSite))