yarn-config.sh 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # Licensed to the Apache Software Foundation (ASF) under one or more
  2. # contributor license agreements. See the NOTICE file distributed with
  3. # this work for additional information regarding copyright ownership.
  4. # The ASF licenses this file to You under the Apache License, Version 2.0
  5. # (the "License"); you may not use this file except in compliance with
  6. # the License. You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  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. function hadoop_subproject_init
  16. {
  17. # at some point in time, someone thought it would be a good idea to
  18. # create separate vars for every subproject. *sigh*
  19. # let's perform some overrides and setup some defaults for bw compat
  20. # this way the common hadoop var's == subproject vars and can be
  21. # used interchangeable from here on out
  22. # ...
  23. # this should get deprecated at some point.
  24. if [[ -z "${HADOOP_YARN_ENV_PROCESSED}" ]]; then
  25. if [[ -e "${YARN_CONF_DIR}/yarn-env.sh" ]]; then
  26. . "${YARN_CONF_DIR}/yarn-env.sh"
  27. elif [[ -e "${HADOOP_CONF_DIR}/yarn-env.sh" ]]; then
  28. . "${HADOOP_CONF_DIR}/yarn-env.sh"
  29. fi
  30. export HADOOP_YARN_ENV_PROCESSED=true
  31. fi
  32. hadoop_deprecate_envvar YARN_CONF_DIR HADOOP_CONF_DIR
  33. hadoop_deprecate_envvar YARN_LOG_DIR HADOOP_LOG_DIR
  34. hadoop_deprecate_envvar YARN_LOGFILE HADOOP_LOGFILE
  35. hadoop_deprecate_envvar YARN_NICENESS HADOOP_NICENESS
  36. hadoop_deprecate_envvar YARN_STOP_TIMEOUT HADOOP_STOP_TIMEOUT
  37. hadoop_deprecate_envvar YARN_PID_DIR HADOOP_PID_DIR
  38. hadoop_deprecate_envvar YARN_ROOT_LOGGER HADOOP_ROOT_LOGGER
  39. hadoop_deprecate_envvar YARN_IDENT_STRING HADOOP_IDENT_STRING
  40. hadoop_deprecate_envvar YARN_OPTS HADOOP_OPTS
  41. hadoop_deprecate_envvar YARN_SLAVES HADOOP_WORKERS
  42. HADOOP_YARN_HOME="${HADOOP_YARN_HOME:-$HADOOP_HOME}"
  43. # YARN-1429 added the completely superfluous YARN_USER_CLASSPATH
  44. # env var. We're going to override HADOOP_CLASSPATH to keep
  45. # consistency with the rest of the duplicate/useless env vars
  46. hadoop_deprecate_envvar YARN_USER_CLASSPATH HADOOP_CLASSPATH
  47. hadoop_deprecate_envvar YARN_USER_CLASSPATH_FIRST HADOOP_USER_CLASSPATH_FIRST
  48. }
  49. if [[ -z "${HADOOP_LIBEXEC_DIR}" ]]; then
  50. _yc_this="${BASH_SOURCE-$0}"
  51. HADOOP_LIBEXEC_DIR=$(cd -P -- "$(dirname -- "${_yc_this}")" >/dev/null && pwd -P)
  52. fi
  53. # shellcheck source=./hadoop-common-project/hadoop-common/src/main/bin/hadoop-config.sh
  54. if [[ -n "${HADOOP_COMMON_HOME}" ]] &&
  55. [[ -e "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" ]]; then
  56. . "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh"
  57. elif [[ -e "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then
  58. . "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh"
  59. elif [ -e "${HADOOP_HOME}/libexec/hadoop-config.sh" ]; then
  60. . "${HADOOP_HOME}/libexec/hadoop-config.sh"
  61. else
  62. echo "ERROR: Hadoop common not found." 2>&1
  63. exit 1
  64. fi