Created
August 10, 2022 03:13
-
-
Save simon-mo/8bf17c9afc736958d1d856bc9e4442e7 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
| from ray import serve | |
| from ray.serve.drivers import DAGDriver | |
| from ray.serve.dag import InputNode | |
| from ray.serve.http_adapters import json_request | |
| @serve.deployment | |
| class A: | |
| def predict(self, inp): | |
| return inp | |
| @serve.deployment | |
| def combine(*inps): | |
| return sum(inps) | |
| As = [A.bind() for _ in range(4)] | |
| with InputNode() as inp: | |
| dag = combine.bind(*[a.predict.bind(inp) for a in As]) | |
| dag = DAGDriver.bind(dag, http_adapter=json_request) | |
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
| wrk.method = "POST" | |
| wrk.body = "1" |
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 psutil | |
| import sys | |
| import json | |
| import time | |
| pid = int(sys.argv[1]) | |
| proc = psutil.Process(pid) | |
| while True: | |
| data = proc.memory_info()._asdict() | |
| data["time"] = time.time() | |
| print(json.dumps(data)) | |
| time.sleep(2) | |
Author
simon-mo
commented
Aug 10, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment