瀏覽代碼

HUE 5653 [jb] Complete implementation of Spark Job History Server REST API

Adrian Yavorskyy 8 年之前
父節點
當前提交
245204b
共有 1 個文件被更改,包括 29 次插入8 次删除
  1. 29 8
      desktop/libs/hadoop/src/hadoop/yarn/spark_history_server_api.py

+ 29 - 8
desktop/libs/hadoop/src/hadoop/yarn/spark_history_server_api.py

@@ -87,14 +87,35 @@ class SparkHistoryServerApi(object):
   def application(self, app_id):
     return self._root.get('applications/%(app_id)s' % {'app_id': app_id}, headers=self.headers)
 
-  def jobs(self, app_id, attempt_id):
-    return self._root.get('applications/%(app_id)s/%(attempt_id)s/jobs' % {'app_id': app_id, 'attempt_id': attempt_id}, headers=self.headers)
+  def jobs(self, app_id):
+    return self._root.get('applications/%(app_id)s/jobs' % {'app_id': app_id}, headers=self.headers)
 
-  def stages(self, app_id, attempt_id):
-    return self._root.get('applications/%(app_id)s/%(attempt_id)s/stages' % {'app_id': app_id, 'attempt_id': attempt_id}, headers=self.headers)
+  def stages(self, app_id):
+    return self._root.get('applications/%(app_id)s/stages' % {'app_id': app_id}, headers=self.headers)
 
-  def executors(self, app_id, attempt_id):
-    return self._root.get('applications/%(app_id)s/%(attempt_id)s/executors' % {'app_id': app_id, 'attempt_id': attempt_id}, headers=self.headers)
+  def executors(self, app_id):
+    return self._root.get('applications/%(app_id)s/executors' % {'app_id': app_id}, headers=self.headers)
 
-  # TODO: stage attempts, task summaries, task list, storage, download logs
-  # http://spark.apache.org/docs/latest/monitoring.html#rest-api
+  def stage_attempts(self, app_id, stage_id):
+    return self._root.get('applications/%(app_id)s/stages/%(stage_id)s' % {'app_id': app_id, 'stage_id': stage_id}, headers=self.headers)
+
+  def stage_attempt(self, app_id, stage_id, stage_attempt_id):
+    return self._root.get('applications/%(app_id)s/stages/%(stage_id)s/%(stage_attempt_id)s' % {'app_id': app_id, 'stage_id': stage_id, 'stage_attempt_id': stage_attempt_id}, headers=self.headers)
+
+  def task_summary(self, app_id, stage_id, stage_attempt_id):
+    return self._root.get('applications/%(app_id)s/stages/%(stage_id)s/%(stage_attempt_id)s/taskSummary' % {'app_id': app_id, 'stage_id': stage_id, 'stage_attempt_id': stage_attempt_id}, headers=self.headers)
+
+  def task_list(self, app_id, stage_id, stage_attempt_id):
+    return self._root.get('applications/%(app_id)s/stages/%(stage_id)s/%(stage_attempt_id)s/taskList' % {'app_id': app_id, 'stage_id': stage_id, 'stage_attempt_id': stage_attempt_id}, headers=self.headers)
+
+  def storages(self, app_id):
+    return self._root.get('applications/%(app_id)s/storage/rdd' % {'app_id': app_id}, headers=self.headers)
+
+  def storage(self, app_id, rdd_id):
+    return self._root.get('applications/%(app_id)s/storage/rdd/%(rdd_id)s' % {'app_id': app_id, 'rdd_id': rdd_id}, headers=self.headers)
+
+  def download_logs(self, app_id):
+    return self._root.get('applications/%(app_id)s/logs' % {'app_id': app_id}, headers=self.headers)
+
+  def download_attempt_logs(self, app_id, attempt_id):
+    return self._root.get('applications/%(app_id)s/%(attempt_id)s/logs' % {'app_id': app_id, 'attempt_id': attempt_id}, headers=self.headers)