README.rst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. Welcome to the repository for Hue
  2. =================================
  3. .. note::
  4. This is the development-oriented readme. If you want to write notes for
  5. end users, please put them in ``dist/README``.
  6. Hue is both a web UI for Hadoop and a framework to create interactive web
  7. applications. It features a FileBrowser for accessing HDFS, JobSub and
  8. JobBrowser applications for submitting and viewing MapReduce jobs, a Beeswax
  9. application for interacting with Hive. On top of that, the web frontend
  10. is mostly built from declarative widgets that require no JavaScript and are
  11. easy to learn.
  12. File Layout
  13. ===========
  14. The "core" stuff is in ``desktop/core/``, whereas installable apps live in
  15. ``apps/``. Please place third-party dependencies in the app's ext-py/
  16. directory.
  17. The typical directory structure for inside an application includes:
  18. src/
  19. for Python code
  20. conf/
  21. for configuration (``.ini``) files to be installed
  22. static/
  23. for static HTML and js resources
  24. templates/
  25. for data to be put through a template engine
  26. docs/
  27. for helpful notes
  28. The python code is structured simply as
  29. ``module/package.py``,
  30. where module may be "filebrowser" or "jobsub". Because it is unlikely that
  31. there are going to be huge conflicts, we're going without a deep nested
  32. hierarchy.
  33. URL Layout
  34. ==========
  35. ``core/src/desktop/urls.py`` contains the current layout for top-level URLs.
  36. For the URLs within your application, you should make your own ``urls.py``
  37. which will be automatically rooted at ``/yourappname/`` in the global
  38. namespace. See ``apps/hello/src/hello/urls.py`` for an example.
  39. Development Prerequisites
  40. ===========================
  41. You'll need these library development packages and tools installed on
  42. your system:
  43. Debian:
  44. * ant
  45. * asciidoc
  46. * gcc
  47. * g++
  48. * libkrb5-dev
  49. * libmysqlclient-dev
  50. * libsasl2-dev
  51. * libsqlite3-dev
  52. * libtidy (for unit tests only)
  53. * libxml2-dev
  54. * libxslt-dev
  55. * mvn (from ``maven2`` package or tarball)
  56. * openldap-dev / libldap2-dev
  57. * python-dev
  58. * python-simplejson
  59. CentOS:
  60. * ant
  61. * asciidoc
  62. * cyrus-sasl-devel
  63. * gcc
  64. * gcc-c++
  65. * krb5-devel
  66. * libtidy (for unit tests only)
  67. * libxml2-devel
  68. * libxslt-devel
  69. * mvn (from ``maven2`` package or tarball)
  70. * mysql
  71. * mysql-devel
  72. * openldap-devel
  73. * python-devel
  74. * python-simplejson
  75. * sqlite-devel
  76. MacOS (mac port):
  77. * liblxml
  78. * libxml2
  79. * libxslt
  80. * mysql5-devel
  81. * simplejson (easy_install)
  82. * sqlite3
  83. Getting Started
  84. ===============
  85. To build and get the core server running::
  86. $ export HADOOP_HOME=<path-to-hadoop-home>
  87. $ git clone http://github.com/cloudera/hue.git
  88. $ cd hue
  89. $ make apps
  90. $ build/env/bin/hue runserver_plus
  91. To start the helper daemons::
  92. $ build/env/bin/hue beeswax_server
  93. $ build/env/bin/hue jobsubd
  94. Now Hue should be running on http://localhost:8000.
  95. FAQ
  96. ===
  97. 1: What does "Exception: no app!" mean?
  98. Your template has an error in it. Check for messages from the server that
  99. look like::
  100. INFO:root:Processing exception: Unclosed tag 'if'. Looking for one of: else, endif
  101. 2: What do I do if I get "There was an error launching ..."?
  102. Turn on debugging by issuing ``dbug.cookie()`` in a Firebug console.
  103. Django Conventions
  104. ==================
  105. If you need to name your urls
  106. (http://docs.djangoproject.com/en/dev/topics/http/urls/#naming-url-patterns)
  107. because there's ambiguity in the view, be sure to prefix the name
  108. with the application name. The url name namespace is global. So
  109. ``jobsub.list`` is fine, but ``list`` is not.
  110. Hue is using Django 1.2, which supports the notion of URL namespaces:
  111. http://docs.djangoproject.com/en/dev/topics/http/urls/#url-namespaces.
  112. We have yet to move over our URLs to this construct. Brownie points for the
  113. developer who takes this on.
  114. Using and Installing Thrift
  115. ===========================
  116. Right now, we check in the generated thrift code.
  117. To generate the code, you'll need the thrift binary version 0.7.0.
  118. Please download from http://thrift.apache.org/.
  119. When preparing ``.thrift`` files, you can use she-bangs to generate
  120. the python bindings like so::
  121. #!/usr/bin/env thrift -r --gen py:new_style -o ../../../
  122. Profiling Hue Apps
  123. ==================
  124. Hue has a profiling system built in, which can be used to analyze server-side
  125. performance of applications. To enable profiling::
  126. $ build/env/bin/hue runprofileserver
  127. Then, access the page that you want to profile. This will create files like
  128. /tmp/useradmin.users.000072ms.2011-02-21T13:03:39.745851.prof. The format for
  129. the file names is /tmp/<app_module>.<page_url>.<time_taken>.<timestamp>.prof.
  130. Hue uses the hotshot profiling library for instrumentation. The documentation
  131. for this library is located at: http://docs.python.org/library/hotshot.html.
  132. To make use of the profiling data quickly, you can create a script that does
  133. the following::
  134. #!/usr/bin/python
  135. import hotshot.stats
  136. import sys
  137. stats = hotshot.stats.load(sys.argv[1])
  138. stats.sort_stats('cumulative', 'calls')
  139. stats.print_stats(100)
  140. This script takes in a .prof file, and orders function calls by the cumulative
  141. time spent in that function, followed by the number of times the function was
  142. called, and then prints out the top 100 time-wasters. For information on the
  143. other stats available, take a look at this website:
  144. http://docs.python.org/library/profile.html#pstats.Stats