Explorar o código

HUE-2061 [jb] Does not use the node address when task is not running

There is no task log yet.
Romain Rigaux %!s(int64=11) %!d(string=hai) anos
pai
achega
d1e9de8
Modificáronse 1 ficheiros con 5 adicións e 3 borrados
  1. 5 3
      apps/jobbrowser/src/jobbrowser/yarn_models.py

+ 5 - 3
apps/jobbrowser/src/jobbrowser/yarn_models.py

@@ -219,11 +219,13 @@ class Attempt:
 
   def get_task_log(self, offset=0):
     logs = []
-    attempt = self.task.job.job_attempts['jobAttempt'][0]
+    attempt = self.task.job.job_attempts['jobAttempt'][-1]
     log_link = attempt['logsLink']
     # Get MR task logs
-    log_link = log_link.replace(attempt['containerId'], self.assignedContainerId)
-    log_link = log_link.replace(attempt['nodeHttpAddress'].split(':')[0], self.nodeHttpAddress.split(':')[0])
+    if self.assignedContainerId:
+      log_link = log_link.replace(attempt['containerId'], self.assignedContainerId)
+    if hasattr(self, 'nodeHttpAddress'):
+      log_link = log_link.replace(attempt['nodeHttpAddress'].split(':')[0], self.nodeHttpAddress.split(':')[0])
 
     for name in ('stdout', 'stderr', 'syslog'):
       link = '/%s/' % name