You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Joy Gao (JIRA)" <ji...@apache.org> on 2018/05/08 01:18:00 UTC

[jira] [Commented] (AIRFLOW-2414) Fix RBAC log display

    [ https://issues.apache.org/jira/browse/AIRFLOW-2414?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16466714#comment-16466714 ] 

Joy Gao commented on AIRFLOW-2414:
----------------------------------

 

Hmm interesting:
{code:java}

if ti is None:
  logs = ["*** Task instance did not exist in the DB\n"]
else:
  logger = logging.getLogger('airflow.task')
  task_log_reader = conf.get('core', 'task_log_reader')
  handler = next((handler for handler in logger.handlers
  if handler.name == task_log_reader), None)
    try:
      ti.task = dag.get_task(ti.task_id)
      logs = handler.read(ti)
    except AttributeError as e:
      logs = ["Task log handler {} does not support read logs.\n{}\n".format(task_log_reader, str(e))]

for i, log in enumerate(logs):
  if PY2 and not isinstance(log, unicode):
    logs[i] = log.decode('utf-8')

{code}
```

Log should be string, wondering if this bug is related to subdags? can you print out the list object and see what it contains? 

> Fix RBAC log display
> --------------------
>
>                 Key: AIRFLOW-2414
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-2414
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: webserver
>    Affects Versions: 1.10.0
>            Reporter: Oleg Yamin
>            Assignee: Oleg Yamin
>            Priority: Major
>             Fix For: 1.10.0
>
>
> Getting the following error when trying to view the log file in new RBAC UI.
> {code:java}
> [2018-05-02 17:49:47,716] ERROR in app: Exception on /log [GET]
> Traceback (most recent call last):
>  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
>  response = self.full_dispatch_request()
>  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
>  rv = self.handle_user_exception(e)
>  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
>  reraise(exc_type, exc_value, tb)
>  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
>  rv = self.dispatch_request()
>  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
>  return self.view_functions[rule.endpoint](**req.view_args)
>  File "/usr/lib/python2.7/site-packages/flask_appbuilder/security/decorators.py", line 26, in wraps
>  return f(self, *args, **kwargs)
>  File "/usr/lib/python2.7/site-packages/airflow/www_rbac/decorators.py", line 55, in wrapper
>  return f(*args, **kwargs)
>  File "/usr/lib/python2.7/site-packages/airflow/utils/db.py", line 74, in wrapper
>  return func(*args, **kwargs)
>  File "/usr/lib/python2.7/site-packages/airflow/www_rbac/views.py", line 456, in log
>  logs = log.decode('utf-8')
> AttributeError: 'list' object has no attribute 'decode'{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)