Skip to content
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

Job Results UI should render log messages immediately #650

Closed
retnuh opened this issue Jul 6, 2021 · 9 comments · Fixed by #1200
Closed

Job Results UI should render log messages immediately #650

retnuh opened this issue Jul 6, 2021 · 9 comments · Fixed by #1200
Labels
type: feature Introduction of new or enhanced functionality to the application
Milestone

Comments

@retnuh
Copy link

retnuh commented Jul 6, 2021

Environment

  • Python version: 3.7
  • Nautobot version: 1.0.3

Steps to Reproduce

  1. Run any job that has time consuming steps

Expected Behavior

Log statements in the job should be rendered when they've been logged. Jobs can be complex and have several steps; it would be nice if the statements appeared while the user is waiting for the job to complete.

Observed Behavior

All log statements appear all at once, after the job completes.

@itdependsnetworks
Copy link
Contributor

@Joezeppe You helped with a similar process before, perhaps you could look at this as well?

pinging @lampwins for visibility.

@glennmatthews
Copy link
Contributor

A few code references that should be useful:

https://github.com/nautobot/nautobot/blob/develop/nautobot/extras/templates/extras/inc/jobresult.html#L34
https://github.com/nautobot/nautobot/blob/develop/nautobot/extras/templates/extras/inc/jobresult.html#L59

We only attempt to render the job logs if the jobresult is completed - removing these checks should be part of the fix.

https://github.com/nautobot/nautobot/blob/develop/nautobot/project-static/js/job_result.js#L35

We only call jobTerminatedAction (which is what reloads the entire page, giving the option to re-render the page template with the latest job logs) if the jobresult is completed.

A simple fix would possibly be to allow the page template to render logs from non-completed JobResults and also to refresh the page every N seconds until a terminal state is reached; a more ideal fix might be to move the job log rendering out of the page template and into the page JS to dynamically re-render the logs as the jobresult data is refreshed via AJAX.

@glennmatthews glennmatthews added status: under review type: feature Introduction of new or enhanced functionality to the application labels Jul 11, 2021
@Joezeppe
Copy link
Contributor

I will look into possible solutions to dynamically render the job logs while it's running.

@jedelman8
Copy link
Contributor

@Joezeppe hey Sammy, are you going to be able to look into this?

@jvanderaa
Copy link
Contributor

@jedelman8 this could be included on the Jobs epic.

@glennmatthews
Copy link
Contributor

As I understand it, the data model changes in #1030 make this much more feasible to implement.

@jedelman8
Copy link
Contributor

Should includes API for job log entry too

@glennmatthews
Copy link
Contributor

#1152 is probably a pre-requisite for this.

@jathanism
Copy link
Contributor

A simple fix would possibly be to allow the page template to render logs from non-completed JobResults and also to refresh the page every N seconds until a terminal state is reached; a more ideal fix might be to move the job log rendering out of the page template and into the page JS to dynamically re-render the logs as the jobresult data is refreshed via AJAX.

The simple fix is easily attainable. Unfortunately since we're using django-tables2 to render the tables, there isn't really an easy way to use something like DataTables or an AJAX call without totally refactoring this view.

jathanism added a commit that referenced this issue Dec 23, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature Introduction of new or enhanced functionality to the application
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

7 participants