-
Notifications
You must be signed in to change notification settings - Fork 14.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AIRFLOW-3623] Support download logs by attempts from UI #4425
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4425 +/- ##
==========================================
- Coverage 78.59% 78.58% -0.02%
==========================================
Files 204 204
Lines 16453 16482 +29
==========================================
+ Hits 12932 12953 +21
- Misses 3521 3529 +8
Continue to review full report at Codecov.
|
Does the feature work when the log is in a remote location(like some s3 directory)? |
Hi @feng-tao , that is a great question. It should work since my changes do not involve any logger handlers. |
Hi @feng-tao I have tested it against the elasticsearch log handler. It works fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. Just left some small comments.
@@ -297,3 +297,16 @@ def parse_template_string(template_string): | |||
return None, Template(template_string) | |||
else: | |||
return template_string, None | |||
|
|||
|
|||
def render_log_filename(ti, try_number, filename_template): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: please provides a docstring for the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -320,6 +326,29 @@ <h4 class="modal-title" id="dagModalLabel"> | |||
$("#div_btn_subdag").show(); | |||
subdag_id = "{{ dag.dag_id }}."+t; | |||
} | |||
|
|||
$("#try_index > li").remove() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: semicolon in the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -320,6 +326,29 @@ <h4 class="modal-title" id="dagModalLabel"> | |||
$("#div_btn_subdag").show(); | |||
subdag_id = "{{ dag.dag_id }}."+t; | |||
} | |||
|
|||
$("#try_index > li").remove() | |||
var startIndex = (try_numbers > 2 ? 0 : 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: semicolon in the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
"&task_id=" + encodeURIComponent(task_id) + | ||
"&execution_date=" + encodeURIComponent(execution_date) + | ||
"&metadata=null" + | ||
"&format=file" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: semicolon in the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
airflow/www/views.py
Outdated
@@ -770,7 +774,12 @@ def get_logs_with_metadata(self, session=None): | |||
task_id = request.args.get('task_id') | |||
execution_date = request.args.get('execution_date') | |||
dttm = pendulum.parse(execution_date) | |||
try_number = int(request.args.get('try_number')) | |||
if request.args.get('try_number', None) is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nit: request.args.get('try_number', None) could be request.args.get('try_number') as the default should be None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
subdag_id = "{{ dag.dag_id }}."+t; | ||
} | ||
|
||
$("#try_index > li").remove() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for the semicolon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:+1
Thanks for your feedback, @feng-tao. I have addressed them. |
thanks @pingzh |
@msumit great point. One big reason for this feature is for large log files, it is expensive to pull the large logs and render in the web UI. |
@msumit , I think your point is valid, but sometimes the log file is very hard to render and view if the file is too large(not sure of the status or the implementation detail for #3992). The log file is very critical for debugging production issue on why the task not running. And adding this action provides to task instance UI panel(all the operations for task instance) provides a way to download the file based on different try number. Hence I think this pr provides value on solving this issue. |
@msumit Thanks for the info. In my mind, for large log files, It is also a good idea to add a download btn after users are in the "View Logs" page. |
Can you please resolve an error that was in the PR but because of broken Travis it wasn't detected:
Please fix it in the new PR. |
@kaxil sorry about that. Here is the PR to fix it: #4446
|
Make sure you have checked all steps below.
Jira
Description
Support download logs by attempts from UI
Tests
Commits
Documentation
Code Quality
flake8
@KevinYang21