Browse Source

[jb] Creating new parser for every request

krish 10 years ago
parent
commit
8da9e9a54f

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

@@ -280,7 +280,7 @@ def job_attempt_logs_json(request, job, attempt_index=0, name='syslog', offset=0
   debug_info = ''
   try:
     response = root.get(link, params=params)
-    log = html.fromstring(response).xpath('/html/body/table/tbody/tr/td[2]')[0].text_content()
+    log = html.fromstring(response, parser=html.HTMLParser()).xpath('/html/body/table/tbody/tr/td[2]')[0].text_content()
   except Exception, e:
     log = _('Failed to retrieve log: %s' % e)
     try:

+ 1 - 1
apps/jobbrowser/src/jobbrowser/yarn_models.py

@@ -340,7 +340,7 @@ class Attempt:
         log_link = re.sub('job_[^/]+', self.id, log_link)
         root = Resource(get_log_client(log_link), urlparse.urlsplit(log_link)[2], urlencode=False)
         response = root.get(link, params=params)
-        log = html.fromstring(response).xpath('/html/body/table/tbody/tr/td[2]')[0].text_content()
+        log = html.fromstring(response, parser=html.HTMLParser()).xpath('/html/body/table/tbody/tr/td[2]')[0].text_content()
       except Exception, e:
         log = _('Failed to retrieve log: %s' % e)
         try: