[serve] Fix utils import in serve deploy
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.shto 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.rstfile.
- [ ] I've added any new APIs to the API Reference. For example, if I added a
method in Tune, I've added it in
- [ ] 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 no problem. LMK if you want to pair on it.
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)