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

[Train/Tune] Warn pending deprecation for ray.train.Trainer and ray.tune DistributedTrainableCreators #24056

Merged
merged 4 commits into from
Apr 26, 2022

Conversation

amogkam
Copy link
Contributor

@amogkam amogkam commented Apr 20, 2022

ray.train.Trainer and ray.tune.integration.*.DistributedTrainableCreator will be deprecated in Ray 2.0 in favor of Ray AIR. In Ray 1.13, we should warn about this pending deprecation.

First step towards #23014

Why are these changes needed?

Related issue number

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

@Yard1
Copy link
Member

Yard1 commented Apr 20, 2022

Add @Deprecated decorators as well?

@amogkam
Copy link
Contributor Author

amogkam commented Apr 20, 2022

Ah @Yard1 we will officially denote as deprecated for Ray 2.0. But for Ray 1.13, we just want to print a warning message saying that this will happen in the future.

@Yard1
Copy link
Member

Yard1 commented Apr 20, 2022

The decorator only adds a message to the docstring that this API will be removed in a future ray release. I think that fits what we want to convey exactly

@amogkam
Copy link
Contributor Author

amogkam commented Apr 20, 2022

The decorator officially denotes the APIs as deprecated (even though may actually be removed in a later release). We don't want to deprecate these APIs in Ray 1.x, and will wait for the major release to do so.

@amogkam
Copy link
Contributor Author

amogkam commented Apr 20, 2022

Basically we don't want this part yet: DEPRECATED: This API is deprecated

@Yard1
Copy link
Member

Yard1 commented Apr 20, 2022

I see, ok! Seems odd to have this warning on init but not in the docstring somewhere, though. We want to dissuade people from using those in the first place, right? Having a mention in the docstring about the pending depreciation would steer users who land on the docs page towards Train.

@amogkam
Copy link
Contributor Author

amogkam commented Apr 20, 2022

Yeah that's a good point. I can definitely manually add it, but I'm not sure if we have standardized on any particular policy across all of Ray.

For reference, this is what Python does:

Python library uses warnings.warn() to emit a deprecation warning in the body of functions.
3 categories are used: DeprecationWarning, PendingDeprecationWarning and FutureWarning.
The docstring doesn’t show anything about deprecation.
The documentation warns about some, but not all, deprecated usages.

From https://deprecated.readthedocs.io/en/latest/white_paper.html.

@xwjiang2010
Copy link
Contributor

How about others under ray/tune/integration?

@amogkam
Copy link
Contributor Author

amogkam commented Apr 21, 2022

@xwjiang2010 these are the only ones we want to deprecate right? (These are the only ones with DistributedTrainableCreators).

@xwjiang2010
Copy link
Contributor

@amogkam Ah I see. That makes sense.
One more question, how about the docs? Like should we update examples here? Or maybe we will wait for 2.0.0 when it's truly deprecated?

@amogkam
Copy link
Contributor Author

amogkam commented Apr 21, 2022

@xwjiang2010 yep let's remove the docs once they are fully deprecated!

Copy link
Member

@bveeramani bveeramani left a comment

Choose a reason for hiding this comment

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

Had a question about the documentation linked. Otherwise LGTM

python/ray/train/trainer.py Outdated Show resolved Hide resolved
@amogkam amogkam requested a review from bveeramani April 25, 2022 21:16
Copy link
Member

@bveeramani bveeramani left a comment

Choose a reason for hiding this comment

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

LGTM

@amogkam amogkam merged commit c3cea7a into ray-project:master Apr 26, 2022
@amogkam amogkam deleted the train-pending-deprecation-warning branch April 26, 2022 20:38
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.

8 participants