eubnara / study

6 stars 2 forks source link

[HUE] webhdfs.py #199

Open eubnara opened 4 years ago

eubnara commented 4 years ago
import hadoop.conf
import desktop.conf

가 어떻게 가능한가?

desktop 앱에서 Makefile 을 보면 virtual env 에 순서대로 각 컴포넌트를 빌드하고 설치한다. 따라서, desktop/core/src/desktop/conf.py, desktop/libs/hadoop/src/hadoop/conf.py 에 있는 것을 desktop/libs/hadoop/src/hadoop/fs/webhdfs.py 에서 받아볼 수 있는 것이다.

eubnara commented 4 years ago
  def _getparams(self):
    return {
      "user.name" : WebHdfs.DEFAULT_USER,
      "doas" : self.user
    }

cf. HUE 에서는 multiple webhdfs 를 명시하도록 지원하지 않는다. httpfs 를 쓰도록 하고 있다. https://github.com/cloudera/hue/pull/530/files knox 를 통한 것은 공식지원은 아니지만 테스트 결과 가능은 하다.

eubnara commented 4 years ago

UnspecifiedConfigSection

desktop/libs/hadoop/src/hadoop/conf.py 참고.

HDFS_CLUSTERS = UnspecifiedConfigSection(
  "hdfs_clusters",
  help="One entry for each HDFS cluster",
  each=ConfigSection(
    help="Information about a single HDFS cluster",
    members=dict(
      FS_DEFAULTFS=Config(
          "fs_defaultfs",
          help="The equivalent of fs.defaultFS (aka fs.default.name)",
          default="hdfs://localhost:8020"
      ),
      LOGICAL_NAME = Config(
          "logical_name",
          default="",
          type=str,
          help=_t('NameNode logical name.')
      ),
      WEBHDFS_URL=Config(
          "webhdfs_url",
          help="The URL to WebHDFS/HttpFS service. Defaults to the WebHDFS URL on the NameNode.",
          type=str,
          default="http://localhost:50070/webhdfs/v1"
      ),
      NN_KERBEROS_PRINCIPAL=Config(
          "nn_kerberos_principal",
          help="Kerberos principal for NameNode", # Unused
          default="hdfs",
          type=str
      ),
      DN_KERBEROS_PRINCIPAL=Config(
          "dn_kerberos_principal",
          help="Kerberos principal for DataNode", # Unused
          default="hdfs",
          type=str
      ),
      SECURITY_ENABLED=Config(
          "security_enabled",
          help="Is running with Kerberos authentication",
          default=False, type=coerce_bool
      ),
      SSL_CERT_CA_VERIFY=Config(
          "ssl_cert_ca_verify",
          help="In secure mode (HTTPS), if SSL certificates from YARN Rest APIs have to be verified against certificate authority",
          dynamic_default=default_ssl_validate,
          type=coerce_bool
      ),
      TEMP_DIR=Config(
          "temp_dir",
          help="HDFS directory for temporary files",
          default='/tmp',
          type=str
      ),
      HADOOP_CONF_DIR = Config(
        key="hadoop_conf_dir",
        dynamic_default=get_hadoop_conf_dir_default,
        help=_t("Directory of the Hadoop configuration) Defaults to the environment variable HADOOP_CONF_DIR when set, or '/etc/hadoop/conf'.")
      )
    )
  )
)