Repository: ambari
Updated Branches:
  refs/heads/trunk e4f80ad8b -> 73be90ac0


AMBARI-6636. Error on YARN Service Check after RM HA enabling.(vbrodetskyi)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/73be90ac
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/73be90ac
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/73be90ac

Branch: refs/heads/trunk
Commit: 73be90ac0a2a6604768ce43a509994533f6fe0ba
Parents: e4f80ad
Author: Vitaly Brodetskyi <vbrodets...@hortonworks.com>
Authored: Mon Jul 28 18:22:11 2014 +0300
Committer: Vitaly Brodetskyi <vbrodets...@hortonworks.com>
Committed: Mon Jul 28 18:22:24 2014 +0300

----------------------------------------------------------------------
 .../files/validateYarnComponentStatus.py        | 59 +++++++++---------
 .../services/YARN/package/scripts/params.py     | 13 +++-
 .../files/validateYarnComponentStatus.py        | 63 +++++++++++---------
 .../services/YARN/package/scripts/params.py     | 13 +++-
 4 files changed, 86 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/73be90ac/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/files/validateYarnComponentStatus.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/files/validateYarnComponentStatus.py
 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/files/validateYarnComponentStatus.py
index dac198a..33ed8b1 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/files/validateYarnComponentStatus.py
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/files/validateYarnComponentStatus.py
@@ -42,28 +42,29 @@ def getResponse(path, address, ssl_enabled):
     url = 'http://' + address + path
       
   command_with_flags = [command,httpGssnegotiate,userpswd,insecure,url]
-  try:
-    proc = subprocess.Popen(command_with_flags, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE)
-    (stdout, stderr) = proc.communicate()
-    response = json.loads(stdout)
-    if response == None:
-      print 'There is no response for url: ' + str(url)
-      exit(1)
-    return response
-  except Exception as e:
-    print 'Error getting response for url:' + str(url), e
-    exit(1)
+
+  proc = subprocess.Popen(command_with_flags, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE)
+  (stdout, stderr) = proc.communicate()
+  response = json.loads(stdout)
+  if response == None:
+    print 'There is no response for url: ' + str(url)
+    raise Exception('There is no response for url: ' + str(url))
+  return response
 
 #Verify that REST api is available for given component
-def validateAvailability(component, path, address, ssl_enabled):
+def validateAvailability(component, path, addresses, ssl_enabled):
+  responses = {}
+  for address in addresses.split(','):
+    try:
+      responses[address] = getResponse(path, address, ssl_enabled)
+    except Exception as e:
+      print 'Error checking availability status of component.', e
+
+  if not responses:
+    exit(1)
 
-  try:
-    response = getResponse(path, address, ssl_enabled)
-    is_valid = validateAvailabilityResponse(component, response)
-    if not is_valid:
-      exit(1)
-  except Exception as e:
-    print 'Error checking availability status of component', e
+  is_valid = validateAvailabilityResponse(component, responses.values()[0])
+  if not is_valid:
     exit(1)
 
 #Validate component-specific response
@@ -96,15 +97,19 @@ def validateAvailabilityResponse(component, response):
     return False
 
 #Verify that component has required resources to work
-def validateAbility(component, path, address, ssl_enabled):
+def validateAbility(component, path, addresses, ssl_enabled):
+  responses = {}
+  for address in addresses.split(','):
+    try:
+      responses[address] = getResponse(path, address, ssl_enabled)
+    except Exception as e:
+      print 'Error checking ability of component.', e
+
+  if not responses:
+    exit(1)
 
-  try:
-    response = getResponse(path, address, ssl_enabled)
-    is_valid = validateAbilityResponse(component, response)
-    if not is_valid:
-      exit(1)
-  except Exception as e:
-    print 'Error checking ability of component', e
+  is_valid = validateAbilityResponse(component, responses.values()[0])
+  if not is_valid:
     exit(1)
 
 #Validate component-specific response that it has required resources to work

http://git-wip-us.apache.org/repos/asf/ambari/blob/73be90ac/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/params.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/params.py
 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/params.py
index 1715123..bc0ad31 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/params.py
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/params.py
@@ -38,7 +38,8 @@ security_enabled = ( not is_empty(_authentication) and 
_authentication == 'kerbe
 smoke_user_keytab = config['configurations']['hadoop-env']['smokeuser_keytab']
 yarn_executor_container_group = 
config['configurations']['yarn-site']['yarn.nodemanager.linux-container-executor.group']
 kinit_path_local = functions.get_kinit_path(["/usr/bin", "/usr/kerberos/bin", 
"/usr/sbin"])
-rm_host = config['clusterHostInfo']['rm_host'][0]
+rm_hosts = config['clusterHostInfo']['rm_host']
+rm_host = rm_hosts[0]
 rm_port = 
config['configurations']['yarn-site']['yarn.resourcemanager.webapp.address'].split(':')[-1]
 rm_https_port = "8090"
 # TODO UPGRADE default, update site during upgrade
@@ -61,8 +62,14 @@ mapred_log_dir_prefix = 
config['configurations']['mapred-env']['mapred_log_dir_p
 mapred_env_sh_template = config['configurations']['mapred-env']['content']
 yarn_env_sh_template = config['configurations']['yarn-env']['content']
 
-rm_webui_address = format("{rm_host}:{rm_port}")
-rm_webui_https_address = format("{rm_host}:{rm_https_port}")
+if len(rm_hosts) > 1:
+  additional_rm_host = rm_hosts[1]
+  rm_webui_address = 
format("{rm_host}:{rm_port},{additional_rm_host}:{rm_port}")
+  rm_webui_https_address = 
format("{rm_host}:{rm_https_port},{additional_rm_host}:{rm_https_port}")
+else:
+  rm_webui_address = format("{rm_host}:{rm_port}")
+  rm_webui_https_address = format("{rm_host}:{rm_https_port}")
+
 nm_webui_address = 
config['configurations']['yarn-site']['yarn.nodemanager.webapp.address']
 hs_webui_address = 
config['configurations']['mapred-site']['mapreduce.jobhistory.webapp.address']
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/73be90ac/ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/files/validateYarnComponentStatus.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/files/validateYarnComponentStatus.py
 
b/ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/files/validateYarnComponentStatus.py
index dac198a..862b4c2 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/files/validateYarnComponentStatus.py
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/files/validateYarnComponentStatus.py
@@ -40,30 +40,31 @@ def getResponse(path, address, ssl_enabled):
     url = 'https://' + address + path
   else:
     url = 'http://' + address + path
-      
+
   command_with_flags = [command,httpGssnegotiate,userpswd,insecure,url]
-  try:
-    proc = subprocess.Popen(command_with_flags, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE)
-    (stdout, stderr) = proc.communicate()
-    response = json.loads(stdout)
-    if response == None:
-      print 'There is no response for url: ' + str(url)
-      exit(1)
-    return response
-  except Exception as e:
-    print 'Error getting response for url:' + str(url), e
-    exit(1)
+
+  proc = subprocess.Popen(command_with_flags, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE)
+  (stdout, stderr) = proc.communicate()
+  response = json.loads(stdout)
+  if response == None:
+    print 'There is no response for url: ' + str(url)
+    raise Exception('There is no response for url: ' + str(url))
+  return response
 
 #Verify that REST api is available for given component
-def validateAvailability(component, path, address, ssl_enabled):
+def validateAvailability(component, path, addresses, ssl_enabled):
+  responses = {}
+  for address in addresses.split(','):
+    try:
+      responses[address] = getResponse(path, address, ssl_enabled)
+    except Exception as e:
+      print 'Error checking availability status of component.', e
+
+  if not responses:
+    exit(1)
 
-  try:
-    response = getResponse(path, address, ssl_enabled)
-    is_valid = validateAvailabilityResponse(component, response)
-    if not is_valid:
-      exit(1)
-  except Exception as e:
-    print 'Error checking availability status of component', e
+  is_valid = validateAvailabilityResponse(component, responses.values()[0])
+  if not is_valid:
     exit(1)
 
 #Validate component-specific response
@@ -96,15 +97,19 @@ def validateAvailabilityResponse(component, response):
     return False
 
 #Verify that component has required resources to work
-def validateAbility(component, path, address, ssl_enabled):
+def validateAbility(component, path, addresses, ssl_enabled):
+  responses = {}
+  for address in addresses.split(','):
+    try:
+      responses[address] = getResponse(path, address, ssl_enabled)
+    except Exception as e:
+      print 'Error checking ability of component.', e
+
+  if not responses:
+    exit(1)
 
-  try:
-    response = getResponse(path, address, ssl_enabled)
-    is_valid = validateAbilityResponse(component, response)
-    if not is_valid:
-      exit(1)
-  except Exception as e:
-    print 'Error checking ability of component', e
+  is_valid = validateAbilityResponse(component, responses.values()[0])
+  if not is_valid:
     exit(1)
 
 #Validate component-specific response that it has required resources to work
@@ -143,7 +148,7 @@ def main():
   (options, args) = parser.parse_args()
 
   component = args[0]
-  
+
   address = options.address
   ssl_enabled = (options.ssl_enabled) in 'true'
   if component == RESOURCEMANAGER:

http://git-wip-us.apache.org/repos/asf/ambari/blob/73be90ac/ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/params.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/params.py
 
b/ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/params.py
index 1c5b97a..f96d2e9 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/params.py
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/params.py
@@ -38,7 +38,8 @@ security_enabled = ( not is_empty(_authentication) and 
_authentication == 'kerbe
 smoke_user_keytab = config['configurations']['global']['smokeuser_keytab']
 yarn_executor_container_group = 
config['configurations']['yarn-site']['yarn.nodemanager.linux-container-executor.group']
 kinit_path_local = functions.get_kinit_path([default("kinit_path_local",None), 
"/usr/bin", "/usr/kerberos/bin", "/usr/sbin"])
-rm_host = config['clusterHostInfo']['rm_host'][0]
+rm_hosts = config['clusterHostInfo']['rm_host']
+rm_host = rm_hosts[0]
 rm_port = 
config['configurations']['yarn-site']['yarn.resourcemanager.webapp.address'].split(':')[-1]
 rm_https_port = "8090"
 rm_nodes_exclude_path = 
config['configurations']['yarn-site']['yarn.resourcemanager.nodes.exclude-path']
@@ -57,8 +58,14 @@ yarn_pid_dir_prefix = status_params.yarn_pid_dir_prefix
 mapred_pid_dir_prefix = status_params.mapred_pid_dir_prefix
 mapred_log_dir_prefix = 
config['configurations']['global']['mapred_log_dir_prefix']
 
-rm_webui_address = format("{rm_host}:{rm_port}")
-rm_webui_https_address = format("{rm_host}:{rm_https_port}")
+if len(rm_hosts) > 1:
+  additional_rm_host = rm_hosts[1]
+  rm_webui_address = 
format("{rm_host}:{rm_port},{additional_rm_host}:{rm_port}")
+  rm_webui_https_address = 
format("{rm_host}:{rm_https_port},{additional_rm_host}:{rm_https_port}")
+else:
+  rm_webui_address = format("{rm_host}:{rm_port}")
+  rm_webui_https_address = format("{rm_host}:{rm_https_port}")
+
 nm_webui_address = 
config['configurations']['yarn-site']['yarn.nodemanager.webapp.address']
 hs_webui_address = 
config['configurations']['mapred-site']['mapreduce.jobhistory.webapp.address']
 

Reply via email to