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

Emmit warning when assign/comparing string with Status Enum. #3875

Merged
merged 6 commits into from
Aug 4, 2020

Conversation

Carreau
Copy link
Contributor

@Carreau Carreau commented Jun 9, 2020

Turn this into an error in the test suite.

We want to make sure of various things:

  1. original behavior of comparing/assign with string still works
    but emit warnings.
    1b) assigning strings convert to proper enum variant.
  2. assign/comparison with invalid strings should fail
  3. warnings are errors in test suite to make sure we don't re-introduce
    strings.

This is the continuation of #3853

@Carreau
Copy link
Contributor Author

Carreau commented Jun 9, 2020

I'm expecting the tests to fail with many more areas where status is still compared with or assingned a string.

@mrocklin
Copy link
Member

mrocklin commented Jun 9, 2020

I'm inclined to not warn just yet, and give downstream libraries a chance to react to this change. Thoughts?

@Carreau
Copy link
Contributor Author

Carreau commented Jun 10, 2020

I'm fine not warning but I think that warnings (wel phrased with the right class) are a good and important communication channel, this is also why I did a PendingDeprecationWarning and not a DeprecationWarning.

I'll also mostly use CI failure to find all the place that need updates.

I can also update the message to say "We are thinking about deprecating ... blah blah", and let the deprecation in master but not release them so that downstread have chance to pitch in on non-release versions.

@mrocklin
Copy link
Member

Yeah, let me rephrase. I think that we should not impose warnings on users yet, at least not until we fix the other Dask sub-packages and have a release cycle or two. If you're using a warning class that is invisile to users under default settings then that seems sensble to me.

@Carreau
Copy link
Contributor Author

Carreau commented Jun 10, 2020

If you're using a warning class that is invisile to users under default settings then that seems sensible to me.

In that case PendingDeprecationWarnings fits that definition. It is not visible in Repl or scripts. I believe since 3.7 only DeprecationWarnings are shown in REPL by default.

@@ -36,19 +36,39 @@ class ProcessInterface:
It should implement the methods below, like ``start`` and ``close``
"""

@property
Copy link
Member

Choose a reason for hiding this comment

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

Maybe instead we should implement this on the Cluster superclass in distributed/deploy/cluster.py

Copy link
Member

Choose a reason for hiding this comment

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

That would also affect most of the downstream projects automatically, which would be useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, but then ssh.Worker and ssh.Scheduler would not inherit this and I believe they were the reason I did this originally.

I think I might end up pulling this into a decorator that can be applied to classes maybe.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, my apologies. I saw the spec.py filename and assumed that this was the SpecCluster class. I see now that it is the ProcessInterface class instead. Happy to retract the comment.

I'd prefer avoiding the iterator and being explicit for now if that's ok, even given the duplication.

# result is not type stable:
# when LHS is not Status then RHS must not be Status or it raises.
# when LHS is Status then RHS must be status or it raises in tests
if reply and ininstance(result, Status) and result != Status.dont_reply:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not super happy with this either.

@Carreau
Copy link
Contributor Author

Carreau commented Jun 20, 2020

Seem like the last few failures are around Status not being serialisable for msgpack. I'm not too sure how to write a custom serializer for that, and if that could be a deal breaker.

Carreau added 6 commits July 23, 2020 18:06
Turn this into an error in the test suite.

We want to make sure of various things:

  1) original behavior of comparing/assign with string still works
  but emit warnings.
  1b) assigning strings convert to proper enum variant.
  2) assign/comparison with invalid strings should fail
  2) warnings are errors in test suite to make sure we don't re-introduce
  strings.

This is the continuation of dask#3853

Maybe Cluster in cluster.py should also get status as a property
@Carreau
Copy link
Contributor Author

Carreau commented Jul 24, 2020

I found here how to do custom packing.

@Carreau
Copy link
Contributor Author

Carreau commented Jul 24, 2020

Yeah ! All tests passing.

There are other places where messagepack is used, but those seem like the only two when those were needed. I defined in serialize as this is where most of msgpack serialisation lies.

If you are happy with this, let me know and I can rebase/squash and update the version number in PeindingDeprecationWarning + something in the changelog.

@Carreau
Copy link
Contributor Author

Carreau commented Aug 3, 2020

Going to ping on this; if you are still +1 on the approach, and if there is anything you want me to change.

@mrocklin
Copy link
Member

mrocklin commented Aug 4, 2020

Sure. Let's give it a try. We're a couple weeks away from a release so we can see who this affects for a while and we'll have plenty of time to revert if necessary.

@mrocklin mrocklin merged commit 586ded3 into dask:master Aug 4, 2020
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.

2 participants