-
-
Notifications
You must be signed in to change notification settings - Fork 719
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 for ProcessInterface
Class and all its subclasses
#5181
Conversation
This is a Draft PR as of now as I have not figured out some key visual details in this representation. I am working on the following at the moment:
|
@jrbourbeau Could you share an example code of ProcessInterface object with which I could play around? |
FeedbackThe most important thing about this class is whether the process is created, running, or closed. It might be worth highlighting this information with colours and/or icons, maybe as a line before the table starts. (Also, this class doesn't have a long list of attributes, so you don't have to stick with a table at all if you don't want to). Example codeOne good strategy for finding examples is to look at the test cases for the thing you're interested in (eg: search for distributed/distributed/deploy/tests/test_spec_cluster.py Lines 259 to 266 in f59e434
For this particular class, we can see that the process gets created, starts running, then is closed. You could make up your own example that moves through each stage of that process, and looks at the HMTL repr between each stage. Optional fun, extending to ssh.py(These suggestions are probably best to go in a new PR, which depend on this PR being merged first) Also, you might want to do the same thing with the distributed/distributed/deploy/ssh.py Line 19 in f59e434
You can try to use tricks like There are two tricks to pay attention to:
Potentially, you could also look at some of the other classes that inherit from |
How about I colour the box next to the title based on the current value of the It also matches the HTML Representations of the other classes such as client, cluster, worker, etc. Color Guideif self.status == Status.created: # Green
status = "Created"
bg_color = "#c7f9cc"
border_color = "#78c6a3"
elif self.status == Status.running: # Blue
status = "Running"
bg_color = "#caf0f8"
border_color = "#48cae4"
elif self.status == Status.closed: # Red
status = "Closed"
bg_color = "#ffbfad"
border_color = "#ff6132" Demo |
Now, I am trying to figure out a way to represent the It would be like a dropdown menu and it would list all the Workers and Schedulers and they would have their own Any suggestions for this PR till then? |
Would it make more sense if:
|
Those colours look great! |
From your screenshots above I think we've lost the Other than that no, I don't have more suggestions. It looks good! |
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 is a good start @freyam. I really like the colours used to represent the state.
The ProcessInterface
object will never be created directly, it is an abstract base class. When it is implemented there is usually one subclass that contains the logic for starting the process and then Worker
and Scheduler
subclasses on top of that. So we need to put some thought into the actual classes that users will want to inspect.
In SSHCluster
it will be distributed.deploy.ssh.Process
which starts a subprocess that calls SSH. For the worker and scheduler the SSH commands will be different, but they will have consistent properties like the process PID.
In a package like dask-cloudprovider
you will have AzureVMCluster
where the process interface implementations will be dask_cloudprovider.azure.azurevm.AzureVM
. This class represents a virtual machine running on Azure which will have a whole bunch of properties such as an ID, instance type, disk size, admin username and password, etc.
So for all the objects that use ProcessInterface
as a base they will either be a scheduler or a worker and will have some number of properties that we will want to be displayed.
distributed/deploy/spec.py
Outdated
position: absolute;" | ||
></div> | ||
<div style="margin-left: 48px"> | ||
<h3 style="margin-bottom: 0px">Process Interface</h3> |
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 class is an interface, it will never be created directly. So we probably want to ensure the name here is the name of the class and not Process Interface
as that phrase means nothing to the user.
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.
Haven't checked, but I think you should be able to grab that information with self.__class__.__name__
@freyam
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.
Hmm, if we will never directly use a ProcessInterface class, but instead always use it through the Worker or Scheduler classes, then perhaps it doesn't make sense to have a heading here.
Instead we might want a html string that can be returned by super()._repr_html_()
and incorporated into the other class representations (#4857)
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.
For clarity when I say Scheduler
and Worker
classes I don't mean distributed.worker.Worker
. I mean something like distributed.deploy.ssh.Worker
which is something different.
@jacobtomlinson Freyam and I are a little confused still about where the access point for the HTML representations is likely to be. Do you intend that the distributed |
All So for a from dask.distributed import LocalCluster, Client, SSHCluster
cluster = SSHCluster(["127.0.0.1", "127.0.0.1", "127.0.0.1"])
cluster
cluster.scheduler
cluster.workers
cluster.workers[0] |
So to answer your question no I wouldn't expect these to be a part of the client/cluster/scheduler info reprs. I agree this is a little confusing though. If we think about a single worker in this example there are four different places where worker info exists.
Today the HTML repr which shows scheduler and worker info is on that There are some things to think about here:
|
Ok, here's what we're going to do. @jacobtomlinson could you open a new issue to discuss consolidating the worker information #5181 (comment) @freyam (if time permits) is going to use |
Added HTML Reprs for |
…ss-interface-html
Added ✔️ |
Added ✅ |
ProcessInterface
Class and all its subclasses.ProcessInterface
Class and all its subclasses
Co-authored-by: Jacob Tomlinson <[email protected]>
Sorry for the messy commit history. It should all be fine now. ✔️ |
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.
Awesome!
CI failures appear unrelated. I'm going to get this in. |
💛 |
black distributed
/flake8 distributed
/isort distributed
I have added the HTML Repr for ProcessInterface Class and all its subclasses.
Before
proc
would call the__repr__()
.After
/cc @martindurant @GenevieveBuckley