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

Add scheduler log tab to performance reports #4909

Merged
merged 4 commits into from
Jun 16, 2021

Conversation

charlesbluca
Copy link
Member

Adds a tab to the performance report with the logs of the scheduler. Note that these are all the logs currently contained in the scheduler's log deque. and not just the logs generated in the performance_report context:

image

@charlesbluca charlesbluca changed the title Scheduler log tab Add scheduler log tab to performance reports Jun 11, 2021
@mrocklin
Copy link
Member

This looks good to me. cc @jacobtomlinson

@fjetter
Copy link
Member

fjetter commented Jun 14, 2021

Note that these are all the logs currently contained in the scheduler's log dequ

we could add timestamps to the get_logs

e.g.

    def get_logs(self, comm=None, n=None, timestamps=False):
        deque_handler = self._deque_handler
        if n is None:
            L = list(deque_handler.deque)
        else:
            L = deque_handler.deque
            L = [L[-i] for i in range(min(n, len(L)))]
        if timstamps:
            return [(msg.created, msg.levelname, deque_handler.format(msg)) for msg in L]
        else:
            return [(msg.levelname, deque_handler.format(msg)) for msg in L]

with the toggle this is fully backwards compat and the report could filter

This can be obviously done in another PR

Copy link
Member

@jacobtomlinson jacobtomlinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great.

I just want to draw your attention to the existing Log and Logs objects which we use to give HTML reprs to get_logs calls today.

class Log(str):
"""A container for logs"""
def _repr_html_(self):
return "<pre><code>\n{log}\n</code></pre>".format(
log=html.escape(self.rstrip())
)
class Logs(dict):
"""A container for multiple logs"""
def _repr_html_(self):
summaries = [
"<details>\n"
"<summary style='display:list-item'>{title}</summary>\n"
"{log}\n"
"</details>".format(title=title, log=log._repr_html_())
for title, log in sorted(self.items())
]
return "\n".join(summaries)

I wonder if these can be ehnanced/reused here?

@quasiben
Copy link
Member

Would you mind also adding a test or an assertion line to the performance_report test ?

Thanks for picking up this issue @charlesbluca !

@charlesbluca
Copy link
Member Author

Sure, thanks for catching that @quasiben 🙂

Thanks for the tip @fjetter! Timestamps could also be useful as part of the log output itself I'd imagine - would definitely be happy to open up a follow up PR implementing that.

I like the idea of reusing the HTML reprs here, I think a potential refactor to match the behavior of this Jinja template would be to change these objects such that:

  • the Log object returns a single line styled with inline CSS conditional on the log level
  • the Logs object returns multiple log lines concatenated together (what Log is currently doing)
  • a new MultiLogs(?) object returns the log lines wrapped in <detail> blocks (what Logs is currently doing)

@jrbourbeau jrbourbeau mentioned this pull request Jun 14, 2021
4 tasks
@jacobtomlinson
Copy link
Member

Flaky test, rerunning.

@mrocklin
Copy link
Member

Are we good to merge here?

@charlesbluca
Copy link
Member Author

Think so, the test failures seem to be flaky - @quasiben is the added assertion in the perf report test sufficient?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include scheduler logs in performance_report
5 participants