8000 docs(prefect-ray): `.wait()` needed (#17732) · CodersSampling/prefect@f30614e · GitHub
[go: up one dir, main page]

Skip to content

Commit f30614e

Browse files
authored
docs(prefect-ray): .wait() needed (PrefectHQ#17732)
1 parent 05e9357 commit f30614e

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

docs/integrations/prefect-ray/index.mdx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ def shout(number):
5252

5353
@flow(task_runner=RayTaskRunner)
5454
def count_to(highest_number):
55-
for number in range(highest_number):
56-
shout.submit(number)
55+
shout.map(range(highest_number)).wait()
5756

5857
if __name__ == "__main__":
5958
count_to(10)
@@ -154,8 +153,7 @@ def say_hello(name: str) -> None:
154153
result_storage="s3/my-result-storage",
155154
)
156155
def greetings(names: List[str]) -> None:
157-
for name in names:
158-
say_hello.submit(name)
156+
say_hello.map(names).wait()
159157

160158

161159
if __name__ == "__main__":
@@ -199,7 +197,7 @@ def process(x):
199197
def my_flow():
200198
# equivalent to setting @ray.remote(num_cpus=4, num_gpus=2)
201199
with remote_options(num_cpus=4, num_gpus=2):
202-
process.submit(42)
200+
process.submit(42).wait()
203201
```
204202

205203
## Resources

src/integrations/prefect-ray/prefect_ray/task_runners.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ def shout(number):
5151
5252
@flow(task_runner=RayTaskRunner)
5353
def count_to(highest_number):
54-
for number in range(highest_number):
55-
shout.submit(number)
54+
shout.map(range(highest_number)).wait()
5655
5756
if __name__ == "__main__":
5857
count_to(10)

0 commit comments

Comments
 (0)
0