- Run
ray start --headin another directory (simulating remote environment in K8s) - Run
python app.py, it will sync the current directory, including my_module.py to the remote cluster curl localhost:8000/freturnsthis from my_module.py::my_func
Created
August 6, 2021 19:01
-
-
Save simon-mo/3311e405606b7f2fd619fd33d53bb945 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import ray | |
| from ray import serve | |
| ray.init("ray://localhost:10001", runtime_env={"working_dir": "."}, namespace="serve") | |
| @serve.deployment | |
| def f(_): | |
| from my_module import my_func | |
| return my_func() | |
| serve.start(detached=True) | |
| f.deploy() | |
This file contains hidden or 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
| def my_func(): | |
| return "this from my_module.py::my_func" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment