airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Howell (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AIRFLOW-1061) Log URL in Task Instance list is incorrect when running locally
Date Tue, 19 Sep 2017 02:58:00 GMT

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

David Howell commented on AIRFLOW-1061:
---------------------------------------

I have this issue too. I've traced back through the code and can see 
This file `airflow/www/views.py`
Has this method `def log_url_formatter() `
Gets the log_url from `airflow/models.py`
Uses `def log_url`
Which has a call to get this: `BASE_URL = configuration.get('webserver', 'BASE_URL')`

This is sourced directly from the airflow.cfg file, the default values shown below:
'''
[webserver]
# The base url of your website as airflow cannot guess what domain or
# cname you are using. This is used in automated emails that
# airflow sends to point links to the right web server
base_url = http://localhost:8080
'''
There's another entry in the cfg file under [cli] for endpoint_url which also uses localhost,
but in that case it makes sense because I can't see the cli being used other than on the master
instance.


So a *quick ( and very nasty) workaround is to replace that base_url with the IP address,
& restart the webserver.* 
I have tested this and it works! Yay, typing over that url was getting very annoying.

However, as you've pointed out other links are able to determine the IP correctly, so this
should too.

For example:
`views.py` : `def task_instance_link` uses the `url_for` method which is part of flask. That's
as far as I got. I assume flask is reading the core model hierarchy from somewhere and determining
urls that way. Without deep diving into flask, I'd assume this method `def log_url_formatter()`
should be able to use something like `url_for(airflow.taskinstance)` . I

> Log URL in Task Instance list is incorrect when running locally
> ---------------------------------------------------------------
>
>                 Key: AIRFLOW-1061
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-1061
>             Project: Apache Airflow
>          Issue Type: Bug
>    Affects Versions: Airflow 1.8
>            Reporter: Nicholas Duffy
>
> The Log URL in the Task Instance list links to BASE_URL + /admin/airflow/log (https://github.com/apache/incubator-airflow/blob/d8c0f59d5d627efb65b47264d5169e3626195839/airflow/models.py#L936)
while it should link to only /admin/airflow/log.
> The current behavior causes the link to be incorrect if you are running Airflow locally.

> Example:
> - Running Airflow on Vagrant on my local machine
> - URL is http://127.0.0.1:8080
> - Browse to task instance list at http://127.0.0.1:8080/admin/taskinstance/
> - Click the Log URL book glyphicon
> - The link takes you to http://mybaseurl.com/admin/airflow/log/
> - I expect the link to go to http://127.0.0.1:8080/admin/airflow/log/



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message