ray icon indicating copy to clipboard operation
ray copied to clipboard

[serve] Fix utils import in serve deploy

Open GeneDer opened this issue 2 years ago • 2 comments

Why are these changes needed?

Re: https://github.com/anyscale/product/issues/20746#issuecomment-1555027363 Currently we have issue to deploy applications containing utils modules and this is still the case with the latest master. After some research, this is caused by python import path ordering ray/dashboard before the user's working directory. @edoakes suggested a great solution to skip ray/dashboard before calling import_attr. This PR will skip ray/dashboard in sys.path so when importing the deployment modules, the user's working directory will take precedence and gets imported.

Related issue number

Closes #20746

Checks

  • [ ] I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • [ ] 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 added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in doc/source/tune/api/ under the corresponding .rst file.
  • [ ] 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 :(

GeneDer avatar Jun 12 '23 16:06 GeneDer

@GeneDer no problem. LMK if you want to pair on it.

edoakes avatar Jun 13 '23 16:06 edoakes

Please also include an automated test here. You can add the serve config you used (or similar) to test_config_files and then write a test that verifies it works as expected (maybe in test_standalone3.py)

edoakes avatar Jun 14 '23 22:06 edoakes