params.py 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. """
  16. from resource_management.libraries.functions.version import format_hdp_stack_version, compare_versions
  17. from resource_management import *
  18. from status_params import *
  19. config = Script.get_config()
  20. stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
  21. hdp_stack_version = format_hdp_stack_version(stack_version_unformatted)
  22. #hadoop params
  23. if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.2') >= 0:
  24. hadoop_bin_dir = "/usr/hdp/current/hadoop-client/bin"
  25. falcon_webapp_dir = "/usr/hdp/current/falcon-client/webapp"
  26. falcon_home = "/usr/hdp/current/falcon-client"
  27. else:
  28. hadoop_bin_dir = "/usr/bin"
  29. falcon_webapp_dir = '/var/lib/falcon/webapp'
  30. falcon_home = '/usr/lib/falcon'
  31. hadoop_conf_dir = "/etc/hadoop/conf"
  32. falcon_conf_dir_prefix = "/etc/falcon"
  33. falcon_conf_dir = format("{falcon_conf_dir_prefix}/conf")
  34. oozie_user = config['configurations']['oozie-env']['oozie_user']
  35. falcon_user = config['configurations']['falcon-env']['falcon_user']
  36. smoke_user = config['configurations']['cluster-env']['smokeuser']
  37. user_group = config['configurations']['cluster-env']['user_group']
  38. proxyuser_group = config['configurations']['hadoop-env']['proxyuser_group']
  39. java_home = config['hostLevelParams']['java_home']
  40. falcon_local_dir = config['configurations']['falcon-env']['falcon_local_dir']
  41. falcon_log_dir = config['configurations']['falcon-env']['falcon_log_dir']
  42. # falcon-startup.properties
  43. store_uri = config['configurations']['falcon-startup.properties']['*.config.store.uri']
  44. # If these properties are present, the directories need to be created.
  45. falcon_graph_storage_directory = default("/configurations/falcon-startup.properties/*.falcon.graph.storage.directory", None) # explicitly set in HDP 2.2 and higher
  46. falcon_graph_serialize_path = default("/configurations/falcon-startup.properties/*.falcon.graph.serialize.path", None) # explicitly set in HDP 2.2 and higher
  47. falcon_embeddedmq_data = config['configurations']['falcon-env']['falcon.embeddedmq.data']
  48. falcon_embeddedmq_enabled = config['configurations']['falcon-env']['falcon.embeddedmq']
  49. falcon_emeddedmq_port = config['configurations']['falcon-env']['falcon.emeddedmq.port']
  50. falcon_host = config['clusterHostInfo']['falcon_server_hosts'][0]
  51. falcon_port = config['configurations']['falcon-env']['falcon_port']
  52. falcon_runtime_properties = config['configurations']['falcon-runtime.properties']
  53. falcon_startup_properties = config['configurations']['falcon-startup.properties']
  54. smokeuser_keytab = config['configurations']['cluster-env']['smokeuser_keytab']
  55. falcon_env_sh_template = config['configurations']['falcon-env']['content']
  56. flacon_apps_dir = '/apps/falcon'
  57. #for create_hdfs_directory
  58. security_enabled = config['configurations']['cluster-env']['security_enabled']
  59. hostname = config["hostname"]
  60. hdfs_user_keytab = config['configurations']['hadoop-env']['hdfs_user_keytab']
  61. hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
  62. hdfs_principal_name = config['configurations']['hadoop-env']['hdfs_principal_name']
  63. kinit_path_local = functions.get_kinit_path(["/usr/bin", "/usr/kerberos/bin", "/usr/sbin"])
  64. import functools
  65. #create partial functions with common arguments for every HdfsDirectory call
  66. #to create hdfs directory we need to call params.HdfsDirectory in code
  67. HdfsDirectory = functools.partial(
  68. HdfsDirectory,
  69. conf_dir=hadoop_conf_dir,
  70. hdfs_user=hdfs_user,
  71. security_enabled = security_enabled,
  72. keytab = hdfs_user_keytab,
  73. kinit_path_local = kinit_path_local,
  74. bin_dir = hadoop_bin_dir
  75. )