forked from ray-project/ray
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[serve] fix serve run ray reinit issue (ray-project#35886)
The current behavior if there is already a ray instance initialized in the import file, serve run command will continue to reinitialize another ray instance and cause error. This PR adds the logic to first checking if there are global ray instance before trying to initialize one for the user. Also added a warning to the user to note if and when the address they passed is different from the existing ray instance.
- Loading branch information
Showing
3 changed files
with
135 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
python/ray/serve/tests/test_config_files/ray_already_initialized.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import ray | ||
from ray import serve | ||
|
||
ray.init(address="auto") | ||
|
||
|
||
@serve.deployment | ||
def f(): | ||
return "foobar" | ||
|
||
|
||
app = f.bind() |