params.py 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. """
  2. Licensed to the Apache Software Foundation (ASF) under one
  3. or more contributor license agreements. See the NOTICE file
  4. distributed with this work for additional information
  5. regarding copyright ownership. The ASF licenses this file
  6. to you under the Apache License, Version 2.0 (the
  7. "License"); you may not use this file except in compliance
  8. with the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. Ambari Agent
  16. """
  17. from resource_management.libraries.functions import conf_select
  18. from resource_management.libraries.functions import format
  19. from resource_management.libraries.functions.version import format_hdp_stack_version
  20. from resource_management.libraries.functions.default import default
  21. from resource_management.libraries.functions import get_kinit_path
  22. from resource_management.libraries.script.script import Script
  23. from resource_management.libraries.resources.hdfs_directory import HdfsDirectory
  24. # server configurations
  25. config = Script.get_config()
  26. tmp_dir = Script.get_tmp_dir()
  27. stack_name = default("/hostLevelParams/stack_name", None)
  28. host_sys_prepped = default("/hostLevelParams/host_sys_prepped", False)
  29. stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
  30. hdp_stack_version = format_hdp_stack_version(stack_version_unformatted)
  31. # New Cluster Stack Version that is defined during the RESTART of a Rolling Upgrade
  32. version = default("/commandParams/version", None)
  33. #mahout params
  34. mahout_home = "/usr/hdp/current/mahout-client"
  35. mahout_conf_dir = "/usr/hdp/current/mahout-client/conf"
  36. mahout_user = config['configurations']['mahout-env']['mahout_user']
  37. #hadoop params
  38. hadoop_bin_dir = "/usr/hdp/current/hadoop-client/bin"
  39. hadoop_home = '/usr/hdp/current/hadoop-client'
  40. # the configuration direction for HDFS/YARN/MapR is the hadoop config
  41. # directory, which is symlinked by hadoop-client only
  42. hadoop_conf_dir = conf_select.get_hadoop_conf_dir()
  43. hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
  44. hdfs_principal_name = config['configurations']['hadoop-env']['hdfs_principal_name']
  45. hdfs_user_keytab = config['configurations']['hadoop-env']['hdfs_user_keytab']
  46. smokeuser = config['configurations']['cluster-env']['smokeuser']
  47. smokeuser_principal = config['configurations']['cluster-env']['smokeuser_principal_name']
  48. user_group = config['configurations']['cluster-env']['user_group']
  49. security_enabled = config['configurations']['cluster-env']['security_enabled']
  50. smoke_user_keytab = config['configurations']['cluster-env']['smokeuser_keytab']
  51. kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))
  52. # not supporting 32 bit jdk.
  53. java64_home = config['hostLevelParams']['java_home']
  54. log4j_props = config['configurations']['mahout-log4j']['content']
  55. import functools
  56. #create partial functions with common arguments for every HdfsDirectory call
  57. #to create hdfs directory we need to call params.HdfsDirectory in code
  58. HdfsDirectory = functools.partial(
  59. HdfsDirectory,
  60. conf_dir=hadoop_conf_dir,
  61. hdfs_user=hdfs_user,
  62. security_enabled = security_enabled,
  63. keytab = hdfs_user_keytab,
  64. kinit_path_local = kinit_path_local,
  65. bin_dir = hadoop_bin_dir
  66. )