conf.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/usr/bin/env python
  2. # Licensed to Cloudera, Inc. under one
  3. # or more contributor license agreements. See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership. Cloudera, Inc. 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. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. from django.utils.translation import ugettext_lazy as _
  18. from desktop.conf import ENABLE_DOWNLOAD
  19. from desktop.lib.conf import Config, coerce_bool
  20. from desktop.conf import is_oozie_enabled
  21. MAX_SNAPPY_DECOMPRESSION_SIZE = Config(
  22. key="max_snappy_decompression_size",
  23. help=_("Max snappy decompression size in bytes."),
  24. private=True,
  25. default=1024*1024*25,
  26. type=int)
  27. ARCHIVE_UPLOAD_TEMPDIR = Config(
  28. key="archive_upload_tempdir",
  29. help=_("Location on local filesystem where the uploaded archives are temporary stored."),
  30. default=None,
  31. type=str)
  32. def get_desktop_enable_download():
  33. """Get desktop enable_download default"""
  34. return ENABLE_DOWNLOAD.get()
  35. SHOW_DOWNLOAD_BUTTON = Config(
  36. key="show_download_button",
  37. help=_("whether to show the download button in hdfs file browser."),
  38. type=coerce_bool,
  39. dynamic_default=get_desktop_enable_download)
  40. SHOW_UPLOAD_BUTTON = Config(
  41. key="show_upload_button",
  42. help=_("whether to show the upload button in hdfs file browser."),
  43. type=coerce_bool,
  44. default=True)
  45. ENABLE_EXTRACT_UPLOADED_ARCHIVE = Config(
  46. key="enable_extract_uploaded_archive",
  47. help=_("Flag to enable the extraction of a uploaded archive in HDFS."),
  48. type=bool,
  49. dynamic_default=is_oozie_enabled
  50. )
  51. REDIRECT_DOWNLOAD = Config(
  52. key="redirect_download",
  53. help=_("Redirect client to WebHdfs or S3 for file download. Note: Turning this on will "\
  54. "override notebook/redirect_whitelist for user selected file downloads on WebHdfs & S3."),
  55. type=coerce_bool,
  56. default=False)
  57. REMOTE_STORAGE_HOME = Config(
  58. key="remote_storage_home",
  59. type=str,
  60. default=None,
  61. help="Optionally set this if you want a different home directory path. e.g. s3a://gethue.")