-
-
Notifications
You must be signed in to change notification settings - Fork 652
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
Fix display of "Snapshotting" in dynamic UI #10797
Conversation
https://asciinema.org/a/360203 shows that snapshot paths are being printed in the dynamic UI again. |
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.
Thank you! I think I see from here how I would fix the Paths
node.
@@ -388,7 +388,7 @@ pub enum SymlinkBehavior { | |||
Oblivious, | |||
} | |||
|
|||
#[derive(Debug)] | |||
#[derive(Debug, Clone, Eq, PartialEq, Hash)] |
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.
I'm surprised to see Eq
implemented - I was reading that that's barely implemented.
Out of curiosity, how do you determine when you do and do not do it? I've read about the difference, but am curious if you have any heuristics you rely on.
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 potentially large object: you should probably not implement Eq
/Hash
on it. The reason Key
was used in this position is that it is much, much smaller (just an integer).
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.
Out of curiosity, how do you determine when you do and do not do it? I've read about the difference, but am curious if you have any heuristics you rely on.
In this case it was because Snapshot
already implemented Eq
, and I didn't dig into why that's the case; maybe PartialEq
would be enough. The distinction between PartialEq
and Eq
in Rust basically exists in order to support the floating point number types; IEEE 754 specifies that floating-point numbers must satisfy NaN != NaN
, which is inconsistent with the requirement on the Eq trait that a == a
for all a
, which PartialEq
doesn't have. Since these types aren't floating point numbers and don't have that weird quirk of floating point numbers, I don't think the distinction matters for anything we're doing.
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.
I'm pretty sure that impl Display for Key
should actually display the Python repr
for the Key
.
If there are particular codepaths (such as the one for Snapshot
, or other workunit rendering code) that don't want to display the "entire" underlying object, I think that they should use the EngineAware
trait to conditionally render Key
's/Value
s based on their types.
A middle ground would be to have impl Display for Key
use the EngineAware
trait under the hood... I'm less sure that that is a good behavior though, because it feels like the EngineAware
trait should be specific to workunit creation.
@@ -388,7 +388,7 @@ pub enum SymlinkBehavior { | |||
Oblivious, | |||
} | |||
|
|||
#[derive(Debug)] | |||
#[derive(Debug, Clone, Eq, PartialEq, Hash)] |
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 potentially large object: you should probably not implement Eq
/Hash
on it. The reason Key
was used in this position is that it is much, much smaller (just an integer).
This is what you suggested on #10658, right? I think this might make sense - change the That said, I still think it makes sense not to use a
|
Maybe. At that point you have two ways to change the display implementation of the type: 1) changing But as I mentioned in the second half of the thing you quoted: the
This change feels like it should be tackled independently of the |
Well in this case the motivation to change the interior type of |
d3ab9c3
to
bc6b0ee
Compare
[ci skip-build-wheels]
# Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
[ci skip-build-wheels]
[ci skip-build-wheels]
bc6b0ee
to
69957e4
Compare
### Problem A recent change to the string representation of the `Key` type affected the `user_facing_name` of the `Snapshot` variant of `NodeKey`, resulting in the dynamic UI displaying "Snapshotting: PathGlobs" rather than a useful path. ### Solution Irrespective of the string representation of a, `Key`, the `Snapshot` variant of `NodeKey` doesn't need to contain a `Key` at all; it can contain a `PathGlobs` object. The code that ran a `Snapshot` Node was already parsing the `Key` into a `PathGlobs` (and handling potential errors in that process), so it was easy enough to move that parsing into the location where we create a `Snapshot` from a Python `Value`. Several traits had to be implemented on `PathGlobs` to maintain the trait implementations that `Snapshot` already had. ### Result Restores the correct behavior for printing the path(s) in a `Snapshot` in the dynamic UI. # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
Problem
A recent change to the string representation of the
Key
type affected theuser_facing_name
of theSnapshot
variant ofNodeKey
, resulting in the dynamic UI displaying "Snapshotting: PathGlobs" rather than a useful path.Solution
Irrespective of the string representation of a,
Key
, theSnapshot
variant ofNodeKey
doesn't need to contain aKey
at all; it can contain aPathGlobs
object. The code that ran aSnapshot
Node was already parsing theKey
into aPathGlobs
(and handling potential errors in that process), so it was easy enough to move that parsing into the location where we create aSnapshot
from a PythonValue
. Several traits had to be implemented onPathGlobs
to maintain the trait implementations thatSnapshot
already had.Result
Restores the correct behavior for printing the path(s) in a
Snapshot
in the dynamic UI.