urls.py 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. import sys
  18. from jobbrowser import views as jobbrowser_views
  19. from jobbrowser import api2 as jobbrowser_api2
  20. if sys.version_info[0] > 2:
  21. from django.urls import re_path
  22. else:
  23. from django.conf.urls import url as re_path
  24. urlpatterns = [
  25. # "Default"
  26. re_path(r'^$', jobbrowser_views.jobs),
  27. re_path(r'^jobs/?$', jobbrowser_views.jobs, name='jobs'),
  28. re_path(r'^jobs/(?P<job>\w+)$', jobbrowser_views.single_job, name='jobbrowser.views.single_job'),
  29. re_path(r'^jobs/(?P<job>\w+)/counters$', jobbrowser_views.job_counters, name='job_counters'),
  30. re_path(r'^jobs/(?P<job>\w+)/kill$', jobbrowser_views.kill_job, name='kill_job'),
  31. re_path(r'^jobs/(?P<job>\w+)/single_logs$', jobbrowser_views.job_single_logs, name='jobbrowser.views.job_single_logs'),
  32. re_path(r'^jobs/(?P<job>\w+)/tasks$', jobbrowser_views.tasks, name='jobbrowser.views.tasks'),
  33. re_path(r'^jobs/(?P<job>\w+)/tasks/(?P<taskid>\w+)$', jobbrowser_views.single_task, name='jobbrowser.views.single_task'), # TODO s/single// ?
  34. re_path(r'^jobs/(?P<job>\w+)/tasks/(?P<taskid>\w+)/attempts/(?P<attemptid>\w+)$',
  35. jobbrowser_views.single_task_attempt, name='single_task_attempt'),
  36. re_path(r'^jobs/(?P<job>\w+)/tasks/(?P<taskid>\w+)/attempts/(?P<attemptid>\w+)/counters$',
  37. jobbrowser_views.task_attempt_counters, name='task_attempt_counters'),
  38. re_path(r'^jobs/(?P<job>\w+)/tasks/(?P<taskid>\w+)/attempts/(?P<attemptid>\w+)/logs$',
  39. jobbrowser_views.single_task_attempt_logs, name='single_task_attempt_logs'),
  40. re_path(r'^jobs/(\w+)/tasks/(\w+)/attempts/(?P<attemptid>\w+)/kill$', jobbrowser_views.kill_task_attempt, name='kill_task_attempt'),
  41. re_path(r'^trackers/(?P<trackerid>.+)$', jobbrowser_views.single_tracker, name='single_tracker'),
  42. re_path(r'^container/(?P<node_manager_http_address>.+)/(?P<containerid>.+)$', jobbrowser_views.container, name='jobbrowser.views.container'),
  43. # MR2 specific
  44. re_path(r'^jobs/(?P<job>\w+)/job_attempt_logs/(?P<attempt_index>\d+)$', jobbrowser_views.job_attempt_logs, name='job_attempt_logs'),
  45. re_path(r'^jobs/(?P<job>\w+)/job_attempt_logs_json/(?P<attempt_index>\d+)(?:/(?P<name>\w+))?(?:/(?P<offset>[\d-]+))?/?$',
  46. jobbrowser_views.job_attempt_logs_json, name='job_attempt_logs_json'),
  47. re_path(r'^jobs/(?P<jobid>\w+)/job_not_assigned/(?P<path>.+)$', jobbrowser_views.job_not_assigned, name='job_not_assigned'),
  48. # Unused
  49. re_path(r'^jobs/(?P<job>\w+)/setpriority$', jobbrowser_views.set_job_priority, name='set_job_priority'),
  50. re_path(r'^trackers$', jobbrowser_views.trackers, name='trackers'),
  51. re_path(r'^clusterstatus$', jobbrowser_views.clusterstatus, name='clusterstatus'),
  52. re_path(r'^queues$', jobbrowser_views.queues, name='queues'),
  53. re_path(r'^jobbrowser$', jobbrowser_views.jobbrowser, name='jobbrowser'),
  54. re_path(r'^dock_jobs/?$', jobbrowser_views.dock_jobs, name='dock_jobs'),
  55. ]
  56. # V2
  57. urlpatterns += [
  58. re_path(r'apps$', jobbrowser_views.apps, name='jobbrowser.views.apps'),
  59. ]
  60. urlpatterns += [
  61. re_path(r'api/jobs(?:/(?P<interface>.+))?/?', jobbrowser_api2.jobs, name='jobs'),
  62. re_path(r'api/job/logs', jobbrowser_api2.logs, name='logs'),
  63. re_path(r'api/job/profile', jobbrowser_api2.profile, name='profile'),
  64. re_path(r'api/job/action(?:/(?P<interface>.+))?(?:/(?P<action>.+))?/?', jobbrowser_api2.action, name='action'),
  65. re_path(r'api/job(?:/(?P<interface>.+))?/?', jobbrowser_api2.job, name='job'),
  66. ]
  67. urlpatterns += [
  68. re_path(r'^query-store/data-bundle/(?P<id>.*)$', jobbrowser_api2.query_store_download_bundle),
  69. re_path(r'^query-store/(?P<path>.*)$', jobbrowser_api2.query_store_api),
  70. ]