فهرست منبع

[jb] Avoid 500 error when job is finished or has no progress info

[beeswax] Fix some broken test with Hive 0.13
Romain Rigaux 11 سال پیش
والد
کامیت
fe6dc17
2فایلهای تغییر یافته به همراه6 افزوده شده و 4 حذف شده
  1. 4 2
      apps/beeswax/src/beeswax/tests.py
  2. 2 2
      apps/jobbrowser/src/jobbrowser/views.py

+ 4 - 2
apps/beeswax/src/beeswax/tests.py

@@ -432,13 +432,15 @@ for x in sys.stdin:
 
     response = _make_query(c, "SELECT SUM(foo) FROM test_explain", submission_type="Explain")
     explanation = json.loads(response.content)['explanation']
-    assert_true('ABSTRACT SYNTAX TREE' in explanation, explanation)
+    assert_true('STAGE DEPENDENCIES:' in explanation, explanation)
+    assert_true('STAGE PLANS:' in explanation, explanation)
 
   def test_explain_query_i18n(self):
     query = u"SELECT foo FROM test_utf8 WHERE bar='%s'" % (unichr(200),)
     response = _make_query(self.client, query, submission_type="Explain")
     explanation = json.loads(response.content)['explanation']
-    assert_true('ABSTRACT SYNTAX TREE' in explanation, explanation)
+    assert_true('STAGE DEPENDENCIES:' in explanation, explanation)
+    assert_true('STAGE PLANS:' in explanation, explanation)
 
   def test_query_i18n(self):
     # Test fails because HIVE_PLAN cannot be found and raises FileNotFoundException

+ 2 - 2
apps/jobbrowser/src/jobbrowser/views.py

@@ -127,10 +127,10 @@ def massage_job_for_json(job, request):
     'cleanupProgress': hasattr(job, 'cleanupProgress') and job.cleanupProgress or '',
     'desiredMaps': job.desiredMaps,
     'desiredReduces': job.desiredReduces,
-    'mapsPercentComplete': int(job.maps_percent_complete),
+    'mapsPercentComplete': int(job.maps_percent_complete) if job.maps_percent_complete else '',
     'finishedMaps': job.finishedMaps,
     'finishedReduces': job.finishedReduces,
-    'reducesPercentComplete': int(job.reduces_percent_complete),
+    'reducesPercentComplete': int(job.reduces_percent_complete) if job.reduces_percent_complete else '',
     'jobFile': hasattr(job, 'jobFile') and job.jobFile or '',
     'launchTimeMs': hasattr(job, 'launchTimeMs') and job.launchTimeMs or '',
     'launchTimeFormatted': hasattr(job, 'launchTimeFormatted') and job.launchTimeFormatted or '',