-
-
Notifications
You must be signed in to change notification settings - Fork 720
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 HTML repr to scheduler_info and incorporate into client and cluster reprs #4857
Add HTML repr to scheduler_info and incorporate into client and cluster reprs #4857
Conversation
That's amazing |
I think that this is great. Thank you @jacobtomlinson . Two questions:
|
|
My biggest worry here is putting HTML inside strings inside Python. It's not particularly easy to parse with your eyes due to a lack of syntax highlighting. String manipulation gets messy quickly. I think a next step might be to refactor all of this out into some jinja2 templates. That would make building more things in the future easier and most importantly more maintainable. |
Sounds good to me :)
…On Thu, May 27, 2021 at 9:02 AM Jacob Tomlinson ***@***.***> wrote:
My biggest worry here is putting HTML inside strings inside Python. It's
not particularly easy to parse with your eyes due to a lack of syntax
highlighting.
String manipulation gets messy quickly.
I think a next step might be to refactor all of this out into some jinja2
templates.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4857 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACKZTFOT6BG7UGAKKZS3BDTPZGIJANCNFSM45T62VTA>
.
|
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.
This looks great, thanks for all your work here @jacobtomlinson : )
My biggest worry here is putting HTML inside strings inside Python. It's not particularly easy to parse with your eyes due to a lack of syntax highlighting.
Agreed that HTML strings in Python are difficult to parse. Incorporating some kind of templating would be a welcomed improvement, though can probably be handled in a follow-up PR
I've nudged things here to support async for the I expect there may be a small conflict when #4865 is merged. But once resolved this should be good to go. |
Hey @jacobtomlinson I notice that the light grey text colour fails the contrast accessibility check here on a white background. Can we update that so it's readable? (Potentially we'll need to be different shades of grey for light vs dark mode backgrounds, not super sure about that.) |
@jacobtomlinson checking in here. I'd love to see this in. It looks like the who_has/has_what stuff was merged. Is it the right time to gently nudge you on this one? :) |
…ler-info-html-repr
Yeah I'll take a look at this today. |
Failed tests are now passing for me locally so 🤞🏻 this is ready for review. |
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 @jacobtomlinson! This looks great : )
Co-authored-by: James Bourbeau <[email protected]>
Thanks @jrbourbeau for the test fixes and the review. Provided CI passes this should be good to merge. |
Test failure seems flaky, rerunning. |
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 @jacobtomlinson!
(test failures are unrelated)
Scheduler info
This PR builds upon #4853 and adds an HTML repr to
Client.scheduler_info()
andcluster.scheduler_info
.Everything is drawn with basic HTML and some inline CSS styling. Most of the heavy lifting is being done by the Jupyter CSS.
I've made heavy use of f-strings throughout but perhaps switching to jinja for HTML reprs may be a better choice in the long run as it will hugely simplify code and duplication. Plus allow for partial templating and reuse. But that would add
jinja2
as a dependency so may be better to have a separate discussion about that.Before
After
Client
I've then expanded the
Client
HTML repr to add a little info about the client and then reuse thescheduler_info
repr.The client info shows how the client was connected, either with a cluster object, a scheduler file or directly with an address. It also shows more information about the cluster object and the path to the scheduler file if applicable.
Before
After
Cluster
Lastly I've updated the cluster HTML repr and widget. The repr got the same treatment as
Client
and adds a little cluster specific info and then reusesscheduler_info
.The
Cluster
class adds minimal cluster info but adds a kwarg to_repr_html_
so that classes lower down can add their own info. I imagine forKubeCluster
we may add some Kubernetes specific info, forEC2Cluster
some AWS specific info, etc.For the
ipywidget
I've added a tabs view where the first tab reuses the HTML repr and the second tab contains the scaling controls which existed before. This should bring some consistency to folks with/without ipywidgets installed.Before (without ipywidgets)
After (without ipywidgets)
Before (with ipywidgets)
After (with ipywidgets)