[jb] Protect from jobs with no available tasks to get some default logs
@@ -194,6 +194,8 @@ class YarnApi(Api):
def logs(self, appid, app_type, log_name):
+ logs = ''
+ try:
if app_type == 'MAPREDUCE':
if log_name == 'default':
response = job_single_logs(MockDjangoRequest(self.user), job=appid)
@@ -205,6 +207,8 @@ class YarnApi(Api):
logs = json.loads(response.content).get('log')
else:
logs = None
+ except PopupException, e:
+ LOG.warn('No task attempt found for logs: %s' % e)
return {'logs': logs}
